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
Ruby
Ruby
show bundled gems
47db62bf8dc380d31f1c106a2cb39b18b7cbf36f
<ide><path>ci/ci_build.rb <ide> def rake(*tasks) <ide> puts "[CruiseControl] #{`pg_config --version`}" <ide> puts "[CruiseControl] SQLite3: #{`sqlite3 -version`}" <ide> `gem env`.each_line {|line| print "[CruiseControl] #{line}"} <del># Commented until bundler supports --list again <del># puts "[CruiseControl] Bundled gems:" <del># `gem bundle --list`.each_line {|line| print "[CruiseControl] #{line}"} <add>puts "[CruiseControl] Bundled gems:" <add>`bundle show`.each_line {|line| print "[CruiseControl] #{line}"} <ide> puts "[CruiseControl] Local gems:" <ide> `gem list`.each_line {|line| print "[CruiseControl] #{line}"} <ide>
1
Python
Python
add defaults for security
1a67ca1adb517b7ae78bc17106847bc9c9648345
<ide><path>airflow/configuration.py <ide> class AirflowConfigException(Exception): <ide> 'smtp': { <ide> 'smtp_starttls': True, <ide> }, <add> 'security': { <add> 'ccache': '/tmp/airflow_krb5_ccache', <add> 'principal': 'airflow', # gets augmented with fqdn <add> 'reinit_frequency': '3600', <add> 'kinit_path': 'kinit', <add> } <ide> } <ide> <ide> DEFAULT_CONFIG = """\
1
Ruby
Ruby
remove validations from example components
05a2a939f0e4e87800b2b1ded5c4708052be13b7
<ide><path>actionpack/test/lib/test_component.rb <ide> # frozen_string_literal: true <ide> <ide> class TestComponent < ActionView::Base <del> include ActiveModel::Validations <del> <del> validates :title, presence: true <ide> delegate :render, to: :view_context <ide> <ide> def initialize(title:) <ide> def initialize(title:) <ide> def render_in(view_context) <ide> self.class.compile <ide> @view_context = view_context <del> validate! <ide> rendered_template <ide> end <ide> <ide><path>actionview/test/lib/test_component.rb <ide> # frozen_string_literal: true <ide> <ide> class TestComponent < ActionView::Base <del> include ActiveModel::Validations <del> <del> validates :content, :title, presence: true <ide> delegate :render, to: :view_context <ide> <ide> def initialize(title:) <ide> def render_in(view_context, &block) <ide> self.class.compile <ide> @view_context = view_context <ide> @content = view_context.capture(&block) if block_given? <del> validate! <ide> rendered_template <ide> end <ide> <ide><path>actionview/test/template/render_test.rb <ide> def test_render_component <ide> @view.render(TestComponent.new(title: "my title")) { "Hello, World!" }.strip <ide> ) <ide> end <del> <del> def test_render_component_with_validation_error <del> error = assert_raises(ActiveModel::ValidationError) do <del> @view.render(TestComponent.new(title: "my title")).strip <del> end <del> <del> assert_match "Content can't be blank", error.message <del> end <ide> end <ide> <ide> class CachedViewRenderTest < ActiveSupport::TestCase
3
Go
Go
add syncpipe for passing context
2412656ef54cb4df36df2f8122e1fda24ec8e8a4
<ide><path>pkg/libcontainer/nsinit/exec.go <ide> package nsinit <ide> <ide> import ( <del> "encoding/json" <ide> "fmt" <ide> "github.com/dotcloud/docker/pkg/libcontainer" <ide> "github.com/dotcloud/docker/pkg/libcontainer/network" <ide> func Exec(container *libcontainer.Container, stdin io.Reader, stdout, stderr io. <ide> <ide> // create a pipe so that we can syncronize with the namespaced process and <ide> // pass the veth name to the child <del> r, w, err := os.Pipe() <add> syncPipe, err := NewSyncPipe() <ide> if err != nil { <ide> return -1, err <ide> } <del> system.UsetCloseOnExec(r.Fd()) <ide> <ide> if container.Tty { <ide> log.Printf("setting up master and console") <ide> func Exec(container *libcontainer.Container, stdin io.Reader, stdout, stderr io. <ide> } <ide> } <ide> <del> command := CreateCommand(container, console, logFile, r.Fd(), args) <del> <add> command := CreateCommand(container, console, logFile, syncPipe.child.Fd(), args) <ide> if container.Tty { <ide> log.Printf("starting copy for tty") <ide> go io.Copy(stdout, master) <ide> func Exec(container *libcontainer.Container, stdin io.Reader, stdout, stderr io. <ide> command.Process.Kill() <ide> return -1, err <ide> } <del> if err := InitializeNetworking(container, command.Process.Pid, w); err != nil { <add> if err := InitializeNetworking(container, command.Process.Pid, syncPipe); err != nil { <ide> command.Process.Kill() <ide> return -1, err <ide> } <ide> <ide> // Sync with child <ide> log.Printf("closing sync pipes") <del> w.Close() <del> r.Close() <add> syncPipe.Close() <ide> <ide> log.Printf("waiting on process") <ide> if err := command.Wait(); err != nil { <ide> func SetupCgroups(container *libcontainer.Container, nspid int) error { <ide> return nil <ide> } <ide> <del>func InitializeNetworking(container *libcontainer.Container, nspid int, pipe io.Writer) error { <add>func InitializeNetworking(container *libcontainer.Container, nspid int, pipe *SyncPipe) error { <ide> if container.Network != nil { <ide> log.Printf("creating host network configuration type %s", container.Network.Type) <ide> strategy, err := network.GetStrategy(container.Network.Type) <ide> func InitializeNetworking(container *libcontainer.Container, nspid int, pipe io. <ide> return err <ide> } <ide> log.Printf("sending %v as network context", networkContext) <del> if err := SendContext(pipe, networkContext); err != nil { <add> if err := pipe.SendToChild(networkContext); err != nil { <ide> return err <ide> } <ide> } <ide> return nil <ide> } <ide> <del>// SendContext writes the veth pair name to the child's stdin then closes the <del>// pipe so that the child stops waiting for more data <del>func SendContext(pipe io.Writer, context libcontainer.Context) error { <del> data, err := json.Marshal(context) <del> if err != nil { <del> return err <del> } <del> pipe.Write(data) <del> return nil <del>} <del> <ide> // SetupWindow gets the parent window size and sets the master <ide> // pty to the current size and set the parents mode to RAW <ide> func SetupWindow(master, parent *os.File) (*term.State, error) { <ide><path>pkg/libcontainer/nsinit/init.go <ide> package nsinit <ide> <ide> import ( <del> "encoding/json" <ide> "fmt" <ide> "github.com/dotcloud/docker/pkg/libcontainer" <ide> "github.com/dotcloud/docker/pkg/libcontainer/capabilities" <ide> "github.com/dotcloud/docker/pkg/libcontainer/network" <ide> "github.com/dotcloud/docker/pkg/system" <del> "io" <del> "io/ioutil" <ide> "log" <ide> "os" <ide> "os/exec" <ide> import ( <ide> <ide> // Init is the init process that first runs inside a new namespace to setup mounts, users, networking, <ide> // and other options required for the new container. <del>func Init(container *libcontainer.Container, uncleanRootfs, console string, pipe io.ReadCloser, args []string) error { <add>func Init(container *libcontainer.Container, uncleanRootfs, console string, syncPipe *SyncPipe, args []string) error { <ide> rootfs, err := resolveRootfs(uncleanRootfs) <ide> if err != nil { <ide> return err <ide> } <ide> log.Printf("initializing namespace at %s", rootfs) <ide> <ide> // We always read this as it is a way to sync with the parent as well <del> context, err := GetContextFromParent(pipe) <add> context, err := syncPipe.ReadFromParent() <ide> if err != nil { <add> syncPipe.Close() <ide> return err <ide> } <add> syncPipe.Close() <add> log.Printf("received context from parent %v", context) <add> <ide> if console != "" { <ide> log.Printf("setting up console for %s", console) <ide> // close pipes so that we can replace it with the pty <del> os.Stdin.Close() <del> os.Stdout.Close() <del> os.Stderr.Close() <add> closeStdPipes() <ide> slave, err := openTerminal(console, syscall.O_RDWR) <ide> if err != nil { <ide> return fmt.Errorf("open terminal %s", err) <ide> func Init(container *libcontainer.Container, uncleanRootfs, console string, pipe <ide> return fmt.Errorf("chdir to %s %s", container.WorkingDir, err) <ide> } <ide> } <add> return execArgs(args, container.Env) <add>} <add> <add>func execArgs(args []string, env []string) error { <ide> name, err := exec.LookPath(args[0]) <ide> if err != nil { <ide> return err <ide> } <del> <ide> log.Printf("execing %s goodbye", name) <del> if err := system.Exec(name, args[0:], container.Env); err != nil { <add> if err := system.Exec(name, args[0:], env); err != nil { <ide> return fmt.Errorf("exec %s", err) <ide> } <ide> panic("unreachable") <ide> } <ide> <add>func closeStdPipes() { <add> os.Stdin.Close() <add> os.Stdout.Close() <add> os.Stderr.Close() <add>} <add> <ide> // resolveRootfs ensures that the current working directory is <ide> // not a symlink and returns the absolute path to the rootfs <ide> func resolveRootfs(uncleanRootfs string) (string, error) { <ide> func setupNetwork(config *libcontainer.Network, context libcontainer.Context) er <ide> } <ide> return nil <ide> } <del> <del>func GetContextFromParent(pipe io.ReadCloser) (libcontainer.Context, error) { <del> defer pipe.Close() <del> data, err := ioutil.ReadAll(pipe) <del> if err != nil { <del> return nil, fmt.Errorf("error reading from stdin %s", err) <del> } <del> var context libcontainer.Context <del> if len(data) > 0 { <del> if err := json.Unmarshal(data, &context); err != nil { <del> return nil, err <del> } <del> log.Printf("received context %v", context) <del> } <del> return context, nil <del>} <ide><path>pkg/libcontainer/nsinit/nsinit/main.go <ide> func main() { <ide> if flag.NArg() < 2 { <ide> log.Fatal(ErrWrongArguments) <ide> } <del> if err := nsinit.Init(container, cwd, console, os.NewFile(uintptr(pipeFd), "pipe"), flag.Args()[1:]); err != nil { <add> syncPipe, err := nsinit.NewSyncPipeFromFd(0, uintptr(pipeFd)) <add> if err != nil { <add> log.Fatal(err) <add> } <add> if err := nsinit.Init(container, cwd, console, syncPipe, flag.Args()[1:]); err != nil { <ide> log.Fatal(err) <ide> } <ide> default: <ide><path>pkg/libcontainer/nsinit/sync_pipe.go <add>package nsinit <add> <add>import ( <add> "encoding/json" <add> "fmt" <add> "github.com/dotcloud/docker/pkg/libcontainer" <add> "github.com/dotcloud/docker/pkg/system" <add> "io/ioutil" <add> "os" <add>) <add> <add>// SyncPipe allows communication to and from the child processes <add>// to it's parent and allows the two independent processes to <add>// syncronize their state. <add>type SyncPipe struct { <add> parent, child *os.File <add>} <add> <add>func NewSyncPipe() (s *SyncPipe, err error) { <add> s = &SyncPipe{} <add> s.child, s.parent, err = os.Pipe() <add> if err != nil { <add> return nil, err <add> } <add> system.UsetCloseOnExec(s.child.Fd()) <add> return s, nil <add>} <add> <add>func NewSyncPipeFromFd(parendFd, childFd uintptr) (*SyncPipe, error) { <add> s := &SyncPipe{} <add> if parendFd > 0 { <add> s.parent = os.NewFile(parendFd, "parendPipe") <add> } else if childFd > 0 { <add> s.child = os.NewFile(childFd, "childPipe") <add> } else { <add> return nil, fmt.Errorf("no valid sync pipe fd specified") <add> } <add> return s, nil <add>} <add> <add>func (s *SyncPipe) SendToChild(context libcontainer.Context) error { <add> data, err := json.Marshal(context) <add> if err != nil { <add> return err <add> } <add> s.parent.Write(data) <add> return nil <add>} <add> <add>func (s *SyncPipe) ReadFromParent() (libcontainer.Context, error) { <add> data, err := ioutil.ReadAll(s.child) <add> if err != nil { <add> return nil, fmt.Errorf("error reading from sync pipe %s", err) <add> } <add> var context libcontainer.Context <add> if len(data) > 0 { <add> if err := json.Unmarshal(data, &context); err != nil { <add> return nil, err <add> } <add> } <add> return context, nil <add> <add>} <add> <add>func (s *SyncPipe) Close() error { <add> if s.parent != nil { <add> s.parent.Close() <add> } <add> if s.child != nil { <add> s.child.Close() <add> } <add> return nil <add>}
4
Python
Python
add type hinting for discord provider
a518801f8d5abe4ceb8b8678c27e6858f51f288a
<ide><path>airflow/providers/discord/hooks/discord_webhook.py <ide> # <ide> import json <ide> import re <add>from typing import Any, Dict, Optional <ide> <ide> from airflow.exceptions import AirflowException <ide> from airflow.providers.http.hooks.http import HttpHook <ide> class DiscordWebhookHook(HttpHook): <ide> """ <ide> <ide> def __init__(self, <del> http_conn_id=None, <del> webhook_endpoint=None, <del> message="", <del> username=None, <del> avatar_url=None, <del> tts=False, <del> proxy=None, <add> http_conn_id: Optional[str] = None, <add> webhook_endpoint: Optional[str] = None, <add> message: str = "", <add> username: Optional[str] = None, <add> avatar_url: Optional[str] = None, <add> tts: bool = False, <add> proxy: Optional[str] = None, <ide> *args, <del> **kwargs): <add> **kwargs) -> None: <ide> super().__init__(*args, **kwargs) <ide> self.http_conn_id = http_conn_id <ide> self.webhook_endpoint = self._get_webhook_endpoint(http_conn_id, webhook_endpoint) <ide> def __init__(self, <ide> self.tts = tts <ide> self.proxy = proxy <ide> <del> def _get_webhook_endpoint(self, http_conn_id, webhook_endpoint): <add> def _get_webhook_endpoint(self, http_conn_id: Optional[str], webhook_endpoint: Optional[str]) -> str: <ide> """ <ide> Given a Discord http_conn_id, return the default webhook endpoint or override if a <ide> webhook_endpoint is manually supplied. <ide> def _get_webhook_endpoint(self, http_conn_id, webhook_endpoint): <ide> <ide> return endpoint <ide> <del> def _build_discord_payload(self): <add> def _build_discord_payload(self) -> str: <ide> """ <ide> Construct the Discord JSON payload. All relevant parameters are combined here <ide> to a valid Discord JSON payload. <ide> <ide> :return: Discord payload (str) to send <ide> """ <del> payload = {} <add> payload: Dict[str, Any] = {} <ide> <ide> if self.username: <ide> payload['username'] = self.username <ide> def _build_discord_payload(self): <ide> <ide> return json.dumps(payload) <ide> <del> def execute(self): <add> def execute(self) -> None: <ide> """ <ide> Execute the Discord webhook call <ide> """ <ide><path>airflow/providers/discord/operators/discord_webhook.py <ide> # specific language governing permissions and limitations <ide> # under the License. <ide> # <add>from typing import Dict, Optional <add> <ide> from airflow.exceptions import AirflowException <ide> from airflow.providers.discord.hooks.discord_webhook import DiscordWebhookHook <ide> from airflow.providers.http.operators.http import SimpleHttpOperator <ide> class DiscordWebhookOperator(SimpleHttpOperator): <ide> <ide> @apply_defaults <ide> def __init__(self, <del> http_conn_id=None, <del> webhook_endpoint=None, <del> message="", <del> username=None, <del> avatar_url=None, <del> tts=False, <del> proxy=None, <add> http_conn_id: Optional[str] = None, <add> webhook_endpoint: Optional[str] = None, <add> message: str = "", <add> username: Optional[str] = None, <add> avatar_url: Optional[str] = None, <add> tts: bool = False, <add> proxy: Optional[str] = None, <ide> *args, <del> **kwargs): <add> **kwargs) -> None: <ide> super().__init__(endpoint=webhook_endpoint, <ide> *args, <ide> **kwargs) <ide> def __init__(self, <ide> self.avatar_url = avatar_url <ide> self.tts = tts <ide> self.proxy = proxy <del> self.hook = None <add> self.hook: Optional[DiscordWebhookHook] = None <ide> <del> def execute(self, context): <add> def execute(self, context: Dict) -> None: <ide> """ <ide> Call the DiscordWebhookHook to post message <ide> """
2
Javascript
Javascript
add explanation why keep var with for loop
4506991aafa59f311024a7290b5195cf030cee7c
<ide><path>lib/internal/async_hooks.js <ide> function emitInitNative(asyncId, type, triggerAsyncId, resource) { <ide> active_hooks.call_depth += 1; <ide> // Use a single try/catch for all hooks to avoid setting up one per iteration. <ide> try { <add> // Using var here instead of let because "for (var ...)" is faster than let. <add> // Refs: https://github.com/nodejs/node/pull/30380#issuecomment-552948364 <ide> for (var i = 0; i < active_hooks.array.length; i++) { <ide> if (typeof active_hooks.array[i][init_symbol] === 'function') { <ide> active_hooks.array[i][init_symbol]( <ide> function emitHook(symbol, asyncId) { <ide> // Use a single try/catch for all hook to avoid setting up one per <ide> // iteration. <ide> try { <add> // Using var here instead of let because "for (var ...)" is faster than let. <add> // Refs: https://github.com/nodejs/node/pull/30380#issuecomment-552948364 <ide> for (var i = 0; i < active_hooks.array.length; i++) { <ide> if (typeof active_hooks.array[i][symbol] === 'function') { <ide> active_hooks.array[i][symbol](asyncId);
1
Javascript
Javascript
add tspan to jsx transform
8e0d17c756ae2b0485316ba63530079ed9608a18
<ide><path>vendor/fbtransform/transforms/xjs.js <ide> var knownTags = { <ide> title: true, <ide> tr: true, <ide> track: true, <add> tspan: true, <ide> u: true, <ide> ul: true, <ide> 'var': true,
1
Javascript
Javascript
remove `symbol()` from real-world example
734a2833e801b68cf64464d55ac98e8d75568004
<ide><path>examples/real-world/src/middleware/api.js <ide> export const Schemas = { <ide> } <ide> <ide> // Action key that carries API call info interpreted by this Redux middleware. <del>export const CALL_API = Symbol('Call API') <add>export const CALL_API = 'Call API' <ide> <ide> // A Redux middleware that interprets actions with CALL_API info specified. <ide> // Performs the call and promises when such actions are dispatched.
1
Ruby
Ruby
fix code style
3b366d05b9c8a29a89bbf773fd2557024ea977b1
<ide><path>Library/Homebrew/cask/dsl.rb <ide> def auto_updates(auto_updates = nil) <ide> <ide> def livecheck(&block) <ide> @livecheck ||= Livecheck.new(self) <del> return @livecheck unless block_given? <add> return @livecheck unless block <ide> <ide> raise CaskInvalidError.new(cask, "'livecheck' stanza may only appear once.") if @livecheckable <ide> <ide><path>Library/Homebrew/dev-cmd/livecheck.rb <ide> def livecheck <ide> <ide> formulae_and_casks_to_check = if args.tap <ide> tap = Tap.fetch(args.tap) <del> formulae = !args.cask? ? tap.formula_names.map { |name| Formula[name] } : [] <del> casks = !args.formula? ? tap.cask_tokens.map { |token| Cask::CaskLoader.load(token) } : [] <add> formulae = args.cask? ? [] : tap.formula_names.map { |name| Formula[name] } <add> casks = args.formula? ? [] : tap.cask_tokens.map { |token| Cask::CaskLoader.load(token) } <ide> formulae + casks <ide> elsif args.installed? <del> formulae = !args.cask? ? Formula.installed : [] <del> casks = !args.formula? ? Cask::Caskroom.casks : [] <add> formulae = args.cask? ? [] : Formula.installed <add> casks = args.formula? ? [] : Cask::Caskroom.casks <ide> formulae + casks <ide> elsif args.all? <del> formulae = !args.cask? ? Formula.to_a : [] <del> casks = !args.formula? ? Cask::Cask.to_a : [] <add> formulae = args.cask? ? [] : Formula.to_a <add> casks = args.formula? ? [] : Cask::Cask.to_a <ide> formulae + casks <ide> elsif args.named.present? <ide> if args.formula? <ide><path>Library/Homebrew/livecheck/livecheck.rb <ide> def run_checks(formulae_and_casks_to_check, args) <ide> separator, method = livecheck_version <ide> Version.new(formula_or_cask.version.to_s.split(separator, 2).try(method)) <ide> elsif formula <del> if formula.head_only? <del> formula.any_installed_version.version.commit <del> else <del> formula.stable.version <del> end <add> if formula.head_only? <add> formula.any_installed_version.version.commit <add> else <add> formula.stable.version <add> end <ide> elsif livecheck_version.is_a?(Symbol) <ide> Version.new(Cask::DSL::Version.new(formula_or_cask.version).try(livecheck_version)) <del> else <del> Version.new(formula_or_cask.version) <add> else <add> Version.new(formula_or_cask.version) <ide> end <ide> <ide> latest = if formula&.stable? || cask <ide> def skip_conditions(formula_or_cask, args:) <ide> if formula&.deprecated? && !formula.livecheckable? <ide> return status_hash(formula, "deprecated", args: args) if args.json? <ide> <del> puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : deprecated" unless args.quiet? <del> return <del> end <add> puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : deprecated" unless args.quiet? <add> return <add> end <ide> <ide> if formula&.disabled? && !formula.livecheckable? <ide> return status_hash(formula, "disabled", args: args) if args.json? <ide> def skip_conditions(formula_or_cask, args:) <ide> if formula&.versioned_formula? && !formula.livecheckable? <ide> return status_hash(formula, "versioned", args: args) if args.json? <ide> <del> puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : versioned" unless args.quiet? <del> return <del> end <add> puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : versioned" unless args.quiet? <add> return <add> end <ide> <ide> if formula&.head_only? && !formula.any_version_installed? <ide> head_only_msg = "HEAD only formula must be installed to be livecheckable" <ide> return status_hash(formula, "error", [head_only_msg], args: args) if args.json? <ide> <del> puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : #{head_only_msg}" unless args.quiet? <del> return <del> end <add> puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : #{head_only_msg}" unless args.quiet? <add> return <add> end <ide> <ide> is_gist = formula&.stable&.url&.include?("gist.github.com") <ide> if formula_or_cask.livecheck.skip? || is_gist <ide> def skip_conditions(formula_or_cask, args:) <ide> puts "#{Tty.red}#{formula_or_cask_name(formula_or_cask, args: args)}#{Tty.reset} : skipped" \ <ide> "#{" - #{skip_msg}" if skip_msg.present?}" <ide> end <del> return <add> return <ide> end <ide> <ide> false
3
Text
Text
add example for caching
82b8a64a02ccc4ff678ac9f9565f25463ecad871
<ide><path>docs/api-guide/caching.md <ide> provided in Django. <ide> <ide> Django provides a [`method_decorator`][decorator] to use <ide> decorators with class based views. This can be used with <del>other cache decorators such as [`cache_page`][page] and <del>[`vary_on_cookie`][cookie]. <add>other cache decorators such as [`cache_page`][page], <add>[`vary_on_cookie`][cookie] and [`vary_on_headers`][headers]. <ide> <ide> ```python <ide> from django.utils.decorators import method_decorator <ide> from django.views.decorators.cache import cache_page <del>from django.views.decorators.vary import vary_on_cookie <add>from django.views.decorators.vary import vary_on_cookie, vary_on_headers <ide> <ide> from rest_framework.response import Response <ide> from rest_framework.views import APIView <ide> from rest_framework import viewsets <ide> <ide> <ide> class UserViewSet(viewsets.ViewSet): <del> <del> # Cache requested url for each user for 2 hours <add> # With cookie: cache requested url for each user for 2 hours <ide> @method_decorator(cache_page(60*60*2)) <ide> @method_decorator(vary_on_cookie) <ide> def list(self, request, format=None): <ide> class UserViewSet(viewsets.ViewSet): <ide> return Response(content) <ide> <ide> <del>class PostView(APIView): <add>class ProfileView(APIView): <add> # With auth: cache requested url for each user for 2 hours <add> @method_decorator(cache_page(60*60*2)) <add> @method_decorator(vary_on_headers("Authorization",)) <add> def get(self, request, format=None): <add> content = { <add> 'user_feed': request.user.get_user_feed() <add> } <add> return Response(content) <ide> <add> <add>class PostView(APIView): <ide> # Cache page for the requested url <ide> @method_decorator(cache_page(60*60*2)) <ide> def get(self, request, format=None): <ide> class PostView(APIView): <ide> <ide> [page]: https://docs.djangoproject.com/en/dev/topics/cache/#the-per-view-cache <ide> [cookie]: https://docs.djangoproject.com/en/dev/topics/http/decorators/#django.views.decorators.vary.vary_on_cookie <add>[headers]: https://docs.djangoproject.com/en/dev/topics/http/decorators/#django.views.decorators.vary.vary_on_headers <ide> [decorator]: https://docs.djangoproject.com/en/dev/topics/class-based-views/intro/#decorating-the-class
1
Ruby
Ruby
use gcc if we tested against the latest llvm
d71e1d07863f3fcfb6e24a425c7ab07e54bad88d
<ide><path>Library/Homebrew/formula.rb <ide> def std_cmake_parameters <ide> def handle_llvm_failure llvm <ide> case ENV.compiler <ide> when :llvm, :clang <add> # version 2335 is the latest version as of Xcode 4.1, so it is the <add> # latest version we have tested against so we will switch to GCC and <add> # bump this integer when Xcode 4.2 is released. TODO do that! <add> if llvm.build.to_i >= 2335 <add> opoo "Formula will not build with LLVM, using GCC" <add> ENV.gcc <add> return <add> end <ide> opoo "Building with LLVM, but this formula is reported to not work with LLVM:" <ide> puts <ide> puts llvm.reason <ide> def handle_llvm_failure llvm <ide> puts <ide> puts "If it doesn't work you can: brew install --use-gcc" <ide> puts <del> else <del> ENV.gcc if MacOS.default_cc =~ /llvm/ <del> return <ide> end <ide> end <ide>
1
Python
Python
raise valueerror for narrow unicode build
6db1ddd9c7776cf07222ae58dc9b2c44135ac59a
<ide><path>spacy/__init__.py <ide> # coding: utf8 <ide> from __future__ import unicode_literals <ide> import warnings <add>import sys <ide> <ide> warnings.filterwarnings("ignore", message="numpy.dtype size changed") <ide> warnings.filterwarnings("ignore", message="numpy.ufunc size changed") <ide> from .errors import Warnings, deprecation_warning <ide> from . import util <ide> <add>if __version__ >= '2.1.0' and sys.maxunicode <= 65535: <add> raise ValueError('''You are running a narrow unicode build, <add> which is incompatible with spacy >= 2.1.0, reinstall Python and use a <add> wide unicode build instead. You can also rebuild Python and <add> set the --enable-unicode=ucs4 flag.''') <add> <ide> <ide> def load(name, **overrides): <ide> depr_path = overrides.get("path")
1
Javascript
Javascript
fix lint errors 2/2
4d00df41b451e5223ac75e6914454b7e44105aa4
<ide><path>packager/blacklist.js <ide> function escapeRegExp(pattern) { <ide> } else if (typeof pattern === 'string') { <ide> var escaped = pattern.replace(/[\-\[\]\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); <ide> // convert the '/' into an escaped local file separator <del> return escaped.replace(/\//g,'\\' + path.sep); <add> return escaped.replace(/\//g, '\\' + path.sep); <ide> } else { <ide> throw new Error('Unexpected packager blacklist pattern: ' + pattern); <ide> } <ide><path>packager/src/Bundler/__tests__/Bundle-test.js <ide> jest.disableAutomock(); <ide> <ide> const Bundle = require('../Bundle'); <ide> const ModuleTransport = require('../../lib/ModuleTransport'); <del>const SourceMapGenerator = require('source-map').SourceMapGenerator; <ide> const crypto = require('crypto'); <ide> <ide> describe('Bundle', () => { <ide> describe('Bundle', () => { <ide> }); <ide> }); <ide> <del> it('should insert modules in a deterministic order, independent from timing of the wrapping process', () => { <del> const moduleTransports = [ <del> createModuleTransport({name: 'module1'}), <del> createModuleTransport({name: 'module2'}), <del> createModuleTransport({name: 'module3'}), <del> ]; <del> <del> const resolves = {}; <del> const resolver = { <del> wrapModule({name}) { <del> return new Promise(resolve => resolves[name] = resolve); <del> }, <del> }; <del> <del> const promise = Promise.all( <del> moduleTransports.map(m => bundle.addModule(resolver, null, {isPolyfill: () => false}, m))) <del> .then(() => { <del> expect(bundle.getModules()) <del> .toEqual(moduleTransports); <del> }); <add> it('inserts modules in a deterministic order, independent of timing of the wrapper process', <add> () => { <add> const moduleTransports = [ <add> createModuleTransport({name: 'module1'}), <add> createModuleTransport({name: 'module2'}), <add> createModuleTransport({name: 'module3'}), <add> ]; <add> <add> const resolves = {}; <add> const resolver = { <add> wrapModule({name}) { <add> return new Promise(resolve => { <add> resolves[name] = resolve; <add> }); <add> }, <add> }; <add> <add> const promise = Promise.all(moduleTransports.map( <add> m => bundle.addModule(resolver, null, {isPolyfill: () => false}, m) <add> )).then(() => { <add> expect(bundle.getModules()) <add> .toEqual(moduleTransports); <add> }); <ide> <del> resolves.module2({code: ''}); <del> resolves.module3({code: ''}); <del> resolves.module1({code: ''}); <add> resolves.module2({code: ''}); <add> resolves.module3({code: ''}); <add> resolves.module1({code: ''}); <ide> <del> return promise; <del> }); <add> return promise; <add> }, <add> ); <ide> }); <ide> <ide> describe('sourcemap bundle', () => { <ide> describe('Bundle', () => { <ide> <ide> describe('getEtag()', function() { <ide> it('should return an etag', function() { <del> var bundle = new Bundle({sourceMapUrl: 'test_url'}); <ide> bundle.finalize({}); <ide> var eTag = crypto.createHash('md5').update(bundle.getSource()).digest('hex'); <ide> expect(bundle.getEtag()).toEqual(eTag); <ide><path>packager/src/Bundler/index.js <ide> const VERSION = require('../../package.json').version; <ide> import type AssetServer from '../AssetServer'; <ide> import type Module, {HasteImpl} from '../node-haste/Module'; <ide> import type ResolutionResponse from '../node-haste/DependencyGraph/ResolutionResponse'; <del>import type {Options as JSTransformerOptions, TransformOptions} from '../JSTransformer/worker/worker'; <add>import type { <add> Options as JSTransformerOptions, <add> TransformOptions, <add>} from '../JSTransformer/worker/worker'; <ide> import type {Reporter} from '../lib/reporting'; <ide> import type GlobalTransformCache from '../lib/GlobalTransformCache'; <ide> <ide><path>packager/src/Bundler/source-map/encode.js <ide> * <ide> * @flow <ide> */ <add> <ide> /** <ide> * Copyright 2011 Mozilla Foundation and contributors <ide> * Licensed under the New BSD license. See LICENSE or: <ide> * http://opensource.org/licenses/BSD-3-Clause <ide> * <ide> * Based on the Base 64 VLQ implementation in Closure Compiler: <del> * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java <add> * https://git.io/vymuA <ide> * <ide> * Copyright 2011 The Closure Compiler Authors. All rights reserved. <ide> * Redistribution and use in source and binary forms, with or without <ide> function toVLQSigned(value) { <ide> * V8 OPTIMIZATION! <ide> */ <ide> function encode(value: number, buffer: Buffer, position: number): number { <del> let digit, vlq = toVLQSigned(value); <add> let vlq = toVLQSigned(value); <add> let digit; <ide> do { <ide> digit = vlq & VLQ_BASE_MASK; <ide> vlq >>>= VLQ_BASE_SHIFT; <ide><path>packager/src/JSTransformer/worker/__tests__/inline-test.js <ide> */ <ide> 'use strict'; <ide> <add>/* eslint-disable max-len */ <add> <ide> jest.disableAutomock(); <ide> const inline = require('../inline'); <ide> const {transform, transformFromAst} = require('babel-core'); <ide> describe('inline constants', () => { <ide> var b = a.ReactNative.Platform.select({}); <ide> }`; <ide> const {ast} = inline('arbitrary.js', {code}, {platform: 'ios'}); <del> expect(toString(ast)).toEqual(normalize(code.replace(/ReactNative\.Platform\.select[^;]+/, '1'))); <add> expect(toString(ast)).toEqual( <add> normalize(code.replace(/ReactNative\.Platform\.select[^;]+/, '1')), <add> ); <ide> }); <ide> <ide> it('replaces React.Platform.select in the code if React is a top level import', () => { <ide> describe('inline constants', () => { <ide> var b = a.ReactNative.Platform.select; <ide> }`; <ide> const {ast} = inline('arbitrary.js', {code}, {platform: 'android'}); <del> expect(toString(ast)).toEqual(normalize(code.replace(/ReactNative.Platform\.select[^;]+/, '2'))); <add> expect(toString(ast)).toEqual( <add> normalize(code.replace(/ReactNative.Platform\.select[^;]+/, '2')), <add> ); <ide> }); <ide> <ide> it('replaces require("react-native").Platform.select in the code', () => { <ide> describe('inline constants', () => { <ide> normalize(code.replace(/process\.env\.NODE_ENV/, '"production"'))); <ide> }); <ide> <del> it('replaces process.env.NODE_ENV in the code', () => { <del> const code = `function a() { <del> if (process.env.NODE_ENV === 'production') { <del> return require('Prod'); <del> } <del> return require('Dev'); <del> }`; <del> const {ast} = inline('arbitrary.js', {code}, {dev: true}); <del> expect(toString(ast)).toEqual( <del> normalize(code.replace(/process\.env\.NODE_ENV/, '"development"'))); <del> }); <del> <ide> it('accepts an AST as input', function() { <ide> const code = 'function ifDev(a,b){return __DEV__?a:b;}'; <ide> const {ast} = inline('arbitrary.hs', {ast: toAst(code)}, {dev: false}); <ide><path>packager/src/JSTransformer/worker/extract-dependencies.js <ide> function extractDependencies(code: string) { <ide> const node = path.node; <ide> const callee = node.callee; <ide> const arg = node.arguments[0]; <del> if (callee.type !== 'Identifier' || callee.name !== 'require' || !arg || arg.type !== 'StringLiteral') { <add> if ( <add> callee.type !== 'Identifier' || <add> callee.name !== 'require' || <add> !arg || <add> arg.type !== 'StringLiteral' <add> ) { <ide> return; <ide> } <ide> dependencyOffsets.push(arg.start); <ide><path>packager/src/ModuleGraph/__tests__/Graph-test.js <ide> describe('Graph:', () => { <ide> }); <ide> }); <ide> <del> it('calls back with an array of modules in depth-first traversal order, regardless of the order of resolution', done => { <del> load.stub.reset(); <del> resolve.stub.reset(); <del> <del> const ids = [ <del> 'a', <del> 'b', <del> 'c', 'd', <del> 'e', <del> 'f', 'g', <del> 'h', <del> ]; <del> ids.forEach(id => { <del> const path = idToPath(id); <del> resolve.stub.withArgs(id).yields(null, path); <del> load.stub.withArgs(path).yields(null, createFile(id), []); <del> }); <del> load.stub.withArgs(idToPath('a')).yields(null, createFile('a'), ['b', 'e', 'h']); <del> load.stub.withArgs(idToPath('b')).yields(null, createFile('b'), ['c', 'd']); <del> load.stub.withArgs(idToPath('e')).yields(null, createFile('e'), ['f', 'g']); <del> <del> // load certain ids later <del> ['b', 'e', 'h'].forEach(id => resolve.stub.withArgs(id).resetBehavior()); <del> resolve.stub.withArgs('h').func = (a, b, c, d, callback) => { <del> callback(null, idToPath('h')); <del> ['e', 'b'].forEach( <del> id => resolve.stub.withArgs(id).yield(null, idToPath(id))); <del> }; <del> <del> graph(['a'], anyPlatform, noOpts, (error, result) => { <del> expect(error).toEqual(null); <del> expect(result.modules).toEqual([ <del> createModule('a', ['b', 'e', 'h']), <del> createModule('b', ['c', 'd']), <del> createModule('c'), <del> createModule('d'), <del> createModule('e', ['f', 'g']), <del> createModule('f'), <del> createModule('g'), <del> createModule('h'), <del> ]); <del> done(); <del> }); <del> }); <add> it('resolves modules in depth-first traversal order, regardless of the order of resolution', <add> done => { <add> load.stub.reset(); <add> resolve.stub.reset(); <add> <add> const ids = [ <add> 'a', <add> 'b', <add> 'c', 'd', <add> 'e', <add> 'f', 'g', <add> 'h', <add> ]; <add> ids.forEach(id => { <add> const path = idToPath(id); <add> resolve.stub.withArgs(id).yields(null, path); <add> load.stub.withArgs(path).yields(null, createFile(id), []); <add> }); <add> load.stub.withArgs(idToPath('a')).yields(null, createFile('a'), ['b', 'e', 'h']); <add> load.stub.withArgs(idToPath('b')).yields(null, createFile('b'), ['c', 'd']); <add> load.stub.withArgs(idToPath('e')).yields(null, createFile('e'), ['f', 'g']); <add> <add> // load certain ids later <add> ['b', 'e', 'h'].forEach(id => resolve.stub.withArgs(id).resetBehavior()); <add> resolve.stub.withArgs('h').func = (a, b, c, d, callback) => { <add> callback(null, idToPath('h')); <add> ['e', 'b'].forEach( <add> id => resolve.stub.withArgs(id).yield(null, idToPath(id))); <add> }; <add> <add> graph(['a'], anyPlatform, noOpts, (error, result) => { <add> expect(error).toEqual(null); <add> expect(result.modules).toEqual([ <add> createModule('a', ['b', 'e', 'h']), <add> createModule('b', ['c', 'd']), <add> createModule('c'), <add> createModule('d'), <add> createModule('e', ['f', 'g']), <add> createModule('f'), <add> createModule('g'), <add> createModule('h'), <add> ]); <add> done(); <add> }); <add> }, <add> ); <ide> <ide> it('calls back with the resolved modules of the entry points', done => { <ide> load.stub.reset(); <ide> describe('Graph:', () => { <ide> }); <ide> }); <ide> <del> it('calls back with the resolved modules of the entry points if one entry point is a dependency of another', done => { <add> it('resolves modules for all entry points correctly if one is a dependency of another', done => { <ide> load.stub.reset(); <ide> resolve.stub.reset(); <ide> <ide><path>packager/src/ModuleGraph/node-haste/HasteFS.js <ide> module.exports = class HasteFS { <ide> } <ide> <ide> closest(path: string, fileName: string): ?string { <del> let {dir, root} = parse(path); <add> const parsedPath = parse(path); <add> const root = parsedPath.root; <add> let dir = parsedPath.dir; <ide> do { <ide> const candidate = join(dir, fileName); <ide> if (this.files.has(candidate)) { <ide> module.exports = class HasteFS { <ide> function buildDirectorySet(files) { <ide> const directories = new Set(); <ide> files.forEach(path => { <del> let {dir, root} = parse(path); <add> const parsedPath = parse(path); <add> const root = parsedPath.root; <add> let dir = parsedPath.dir; <ide> while (dir !== '.' && dir !== root && !directories.has(dir)) { <ide> directories.add(dir); <ide> dir = dirname(dir); <ide><path>packager/src/ModuleGraph/worker/__tests__/collect-dependencies-test.js <ide> describe('dependency collection from ASTs:', () => { <ide> .toEqual(any(String)); <ide> }); <ide> <del> it('replaces all required module ID strings with array lookups and keeps the ID as second argument', () => { <del> const ast = astFromCode(` <del> const a = require('b/lib/a'); <del> const b = require(123); <del> exports.do = () => require("do"); <del> if (!something) { <del> require("setup/something"); <del> } <del> `); <del> <del> const {dependencyMapName} = collectDependencies(ast); <del> <del> expect(codeFromAst(ast)).toEqual(comparableCode(` <del> const a = require(${dependencyMapName}[0], 'b/lib/a'); <del> const b = require(123); <del> exports.do = () => require(${dependencyMapName}[1], "do"); <del> if (!something) { <del> require(${dependencyMapName}[2], "setup/something"); <del> } <del> `)); <del> }); <add> it('replaces all required module ID strings with array lookups, keeps the ID as second argument', <add> () => { <add> const ast = astFromCode(` <add> const a = require('b/lib/a'); <add> const b = require(123); <add> exports.do = () => require("do"); <add> if (!something) { <add> require("setup/something"); <add> } <add> `); <add> <add> const {dependencyMapName} = collectDependencies(ast); <add> <add> expect(codeFromAst(ast)).toEqual(comparableCode(` <add> const a = require(${dependencyMapName}[0], 'b/lib/a'); <add> const b = require(123); <add> exports.do = () => require(${dependencyMapName}[1], "do"); <add> if (!something) { <add> require(${dependencyMapName}[2], "setup/something"); <add> } <add> `)); <add> }, <add> ); <ide> }); <ide> <ide> describe('Dependency collection from optimized ASTs:', () => { <ide><path>packager/src/ModuleGraph/worker/__tests__/optimize-module-test.js <ide> function findLast(code, needle) { <ide> return {line: line + 1, column}; <ide> } <ide> } <add> return null; <ide> } <ide><path>packager/src/ModuleGraph/worker/__tests__/transform-module-test.js <ide> const {parse} = require('babylon'); <ide> const generate = require('babel-generator').default; <ide> const {traverse} = require('babel-core'); <ide> <del>const {any, objectContaining} = jasmine; <del> <ide> describe('transforming JS modules:', () => { <ide> const filename = 'arbitrary'; <ide> <ide> describe('transforming JS modules:', () => { <ide> <ide> it('passes through file name and code', done => { <ide> transformModule(sourceCode, options(), (error, result) => { <del> expect(result).toEqual(objectContaining({ <add> expect(result).toEqual(expect.objectContaining({ <ide> code: sourceCode, <ide> file: filename, <ide> })); <ide> describe('transforming JS modules:', () => { <ide> const hasteID = 'TheModule'; <ide> const codeWithHasteID = `/** @providesModule ${hasteID} */`; <ide> transformModule(codeWithHasteID, options(), (error, result) => { <del> expect(result).toEqual(objectContaining({hasteID})); <add> expect(result).toEqual(expect.objectContaining({hasteID})); <ide> done(); <ide> }); <ide> }); <ide> <ide> it('sets `type` to `"module"` by default', done => { <ide> transformModule(sourceCode, options(), (error, result) => { <del> expect(result).toEqual(objectContaining({type: 'module'})); <add> expect(result).toEqual(expect.objectContaining({type: 'module'})); <ide> done(); <ide> }); <ide> }); <ide> <ide> it('sets `type` to `"script"` if the input is a polyfill', done => { <ide> transformModule(sourceCode, {...options(), polyfill: true}, (error, result) => { <del> expect(result).toEqual(objectContaining({type: 'script'})); <add> expect(result).toEqual(expect.objectContaining({type: 'script'})); <ide> done(); <ide> }); <ide> }); <ide> <del> it('calls the passed-in transform function with code, file name, and options for all passed in variants', done => { <del> const variants = {dev: {dev: true}, prod: {dev: false}}; <add> it('calls the passed-in transform function with code, file name, and options ' + <add> 'for all passed in variants', <add> done => { <add> const variants = {dev: {dev: true}, prod: {dev: false}}; <ide> <del> transformModule(sourceCode, options(variants), () => { <del> expect(transformer.transform) <del> .toBeCalledWith(sourceCode, filename, variants.dev); <del> expect(transformer.transform) <del> .toBeCalledWith(sourceCode, filename, variants.prod); <del> done(); <del> }); <del> }); <add> transformModule(sourceCode, options(variants), () => { <add> expect(transformer.transform) <add> .toBeCalledWith(sourceCode, filename, variants.dev); <add> expect(transformer.transform) <add> .toBeCalledWith(sourceCode, filename, variants.prod); <add> done(); <add> }); <add> }, <add> ); <ide> <ide> it('calls back with any error yielded by the transform function', done => { <ide> const error = new Error(); <ide> describe('transforming JS modules:', () => { <ide> }); <ide> }); <ide> <del> it('wraps the code produced by the transform function into an immediately invoked function expression for polyfills', done => { <add> it('wraps the code produced by the transform function into an IIFE for polyfills', done => { <ide> transformModule(sourceCode, {...options(), polyfill: true}, (error, result) => { <ide> expect(error).toEqual(null); <ide> <ide> describe('transforming JS modules:', () => { <ide> const column = code.indexOf('code'); <ide> const consumer = new SourceMapConsumer(map); <ide> expect(consumer.originalPositionFor({line: 1, column})) <del> .toEqual(objectContaining({line: 1, column: sourceCode.indexOf('code')})); <add> .toEqual(expect.objectContaining({line: 1, column: sourceCode.indexOf('code')})); <ide> done(); <ide> }); <ide> }); <ide> <ide> it('extracts dependencies (require calls)', done => { <del> const dep1 = 'foo', dep2 = 'bar'; <add> const dep1 = 'foo'; <add> const dep2 = 'bar'; <ide> const code = `require('${dep1}'),require('${dep2}')`; <ide> const {body} = parse(code).program; <ide> transformer.transform.stub.returns(transformResult(body)); <ide> <ide> transformModule(code, options(), (error, result) => { <ide> expect(result.transformed.default) <del> .toEqual(objectContaining({dependencies: [dep1, dep2]})); <add> .toEqual(expect.objectContaining({dependencies: [dep1, dep2]})); <ide> done(); <ide> }); <ide> }); <ide> describe('transforming JS modules:', () => { <ide> it('does not create source maps for JSON files', done => { <ide> transformModule('{}', {...options(), filename: 'some.json'}, (error, result) => { <ide> expect(result.transformed.default) <del> .toEqual(objectContaining({map: null})); <add> .toEqual(expect.objectContaining({map: null})); <ide> done(); <ide> }); <ide> }); <ide><path>packager/src/ModuleGraph/worker/transform-module.js <ide> function transformModule( <ide> callback: Callback<TransformedFile>, <ide> ): void { <ide> if (options.filename.endsWith('.json')) { <del> return transformJSON(code, options, callback); <add> transformJSON(code, options, callback); <add> return; <ide> } <ide> <ide> const {filename, transformer, variants = defaultVariants} = options; <ide> function transformModule( <ide> type: options.polyfill ? 'script' : 'module', <ide> }); <ide> }); <add> return; <ide> } <ide> <ide> function transformJSON(json, options, callback) { <ide><path>packager/src/Resolver/__tests__/Resolver-test.js <ide> describe('Resolver', function() { <ide> }); <ide> }); <ide> <del> it('should get dependencies with polyfills', function() { <del> var module = createModule('index'); <del> var deps = [module]; <del> <del> var depResolver = new Resolver({ <del> projectRoot: '/root', <del> }); <del> <del> DependencyGraph.prototype.getDependencies.mockImplementation(function() { <del> return Promise.resolve(new ResolutionResponseMock({ <del> dependencies: deps, <del> mainModuleId: 'index', <del> })); <del> }); <del> <del> const polyfill = {}; <del> DependencyGraph.prototype.createPolyfill.mockReturnValueOnce(polyfill); <del> return depResolver <del> .getDependencies( <del> '/root/index.js', <del> {dev: true}, <del> undefined, <del> undefined, <del> createGetModuleId() <del> ).then(function(result) { <del> expect(result.mainModuleId).toEqual('index'); <del> expect(DependencyGraph.mock.instances[0].getDependencies) <del> .toBeCalledWith({entryPath: '/root/index.js', recursive: true}); <del> expect(result.dependencies[0]).toBe(polyfill); <del> expect(result.dependencies[result.dependencies.length - 1]) <del> .toBe(module); <del> }); <del> }); <del> <ide> it('should pass in more polyfills', function() { <ide> var module = createModule('index'); <ide> var deps = [module]; <ide> describe('Resolver', function() { <ide> createGetModuleId() <ide> ).then(result => { <ide> expect(result.mainModuleId).toEqual('index'); <del> expect(DependencyGraph.prototype.createPolyfill.mock.calls[result.dependencies.length - 2]).toEqual([ <add> const calls = <add> DependencyGraph.prototype.createPolyfill.mock.calls[result.dependencies.length - 2]; <add> expect(calls).toEqual([ <ide> {file: 'some module', <ide> id: 'some module', <ide> dependencies: [ <ide> describe('Resolver', function() { <ide> expect(processedCode).toEqual([ <ide> '(function(global) {', <ide> 'global.fetch = () => 1;', <del> "\n})(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this);", <add> '\n})' + <add> "(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this);", <ide> ].join('')); <ide> }); <ide> }); <ide><path>packager/src/Resolver/index.js <ide> class Resolver { <ide> }, <ide> platforms: new Set(opts.platforms), <ide> preferNativePlatform: true, <del> providesModuleNodeModules: opts.providesModuleNodeModules || defaults.providesModuleNodeModules, <add> providesModuleNodeModules: <add> opts.providesModuleNodeModules || defaults.providesModuleNodeModules, <ide> reporter: opts.reporter, <ide> resetCache: opts.resetCache, <ide> roots: opts.projectRoots, <ide> function defineModuleCode(moduleName, code, verboseName = '', dev = true) { <ide> ].join(''); <ide> } <ide> <del>function definePolyfillCode(code,) { <add>function definePolyfillCode(code) { <ide> return [ <ide> '(function(global) {', <ide> code, <ide><path>packager/src/Resolver/polyfills/Number.es6.js <ide> if (Number.MIN_SAFE_INTEGER === undefined) { <ide> }); <ide> } <ide> if (!Number.isNaN) { <add> // eslint-disable-next-line max-len <ide> // https://github.com/dherman/tc39-codex-wiki/blob/master/data/es6/number/index.md#polyfill-for-numberisnan <ide> const globalIsNaN = global.isNaN; <ide> Object.defineProperty(Number, 'isNaN', { <ide><path>packager/src/Resolver/polyfills/error-guard.js <ide> const ErrorUtils = { <ide> } finally { <ide> _inGuard--; <ide> } <add> return null; <ide> }, <ide> applyWithGuardIfNeeded(fun, context, args) { <ide> if (ErrorUtils.inGuard()) { <ide> return fun.apply(context, args); <ide> } else { <ide> ErrorUtils.applyWithGuard(fun, context, args); <ide> } <add> return null; <ide> }, <ide> inGuard() { <ide> return _inGuard; <ide><path>packager/src/Server/index.js <ide> const { <ide> } = require('../Logger'); <ide> <ide> function debounceAndBatch(fn, delay) { <del> let timeout, args = []; <add> let args = []; <add> let timeout; <ide> return value => { <ide> args.push(value); <ide> clearTimeout(timeout); <ide> class Server { <ide> 'entryModuleOnly', <ide> false, <ide> ), <del> generateSourceMaps: minify || !dev || this._getBoolOptionFromQuery(urlObj.query, 'babelSourcemap', false), <add> generateSourceMaps: <add> minify || !dev || this._getBoolOptionFromQuery(urlObj.query, 'babelSourcemap', false), <ide> assetPlugins, <ide> }; <ide> } <ide><path>packager/src/lib/relativizeSourceMap.js <ide> import type {MixedSourceMap} from './SourceMap'; <ide> <ide> function relativizeSourceMapInternal(sourceMap: any, sourcesRoot: string) { <ide> if (sourceMap.sections) { <del> for (var i = 0; i < sourceMap.sections.length; i++) { <add> for (let i = 0; i < sourceMap.sections.length; i++) { <ide> relativizeSourceMapInternal(sourceMap.sections[i].map, sourcesRoot); <ide> } <ide> } else { <del> for (var i = 0; i < sourceMap.sources.length; i++) { <add> for (let i = 0; i < sourceMap.sources.length; i++) { <ide> sourceMap.sources[i] = path.relative(sourcesRoot, sourceMap.sources[i]); <ide> } <ide> } <ide><path>packager/src/node-haste/DependencyGraph/HasteMap.js <ide> class HasteMap extends EventEmitter { <ide> return this._processHasteModule(absPath, invalidated); <ide> } <ide> } <add> return null; <ide> }); <ide> } <ide> <ide><path>packager/src/node-haste/__mocks__/graceful-fs.js <ide> fs.realpath.mockImplementation((filepath, callback) => { <ide> if (node && typeof node === 'object' && node.SYMLINK != null) { <ide> return callback(null, node.SYMLINK); <ide> } <del> callback(null, filepath); <add> return callback(null, filepath); <ide> }); <ide> <ide> fs.readdirSync.mockImplementation(filepath => Object.keys(getToNode(filepath))); <ide> fs.readdir.mockImplementation((filepath, callback) => { <ide> return callback(new Error(filepath + ' is not a directory.')); <ide> } <ide> <del> callback(null, Object.keys(node)); <add> return callback(null, Object.keys(node)); <ide> }); <ide> <ide> fs.readFile.mockImplementation(function(filepath, encoding, callback) { <ide> fs.readFile.mockImplementation(function(filepath, encoding, callback) { <ide> callback(new Error('Error readFile a dir: ' + filepath)); <ide> } <ide> if (node == null) { <del> callback(Error('No such file: ' + filepath)); <add> return callback(Error('No such file: ' + filepath)); <ide> } else { <del> callback(null, node); <add> return callback(null, node); <ide> } <ide> } catch (e) { <ide> return callback(e); <ide><path>packager/src/node-haste/__tests__/DependencyGraph-test.js <ide> describe('DependencyGraph', function() { <ide> }); <ide> }); <ide> <del> it('should work with packages', function() { <add> it('should work with packages with a trailing slash', function() { <ide> var root = '/root'; <ide> setMockFileSystem({ <ide> 'root': { <ide><path>packager/src/node-haste/index.js <ide> class DependencyGraph extends EventEmitter { <ide> moduleOptions: this._opts.moduleOptions, <ide> reporter: this._opts.reporter, <ide> getClosestPackage: filePath => { <del> let {dir, root} = path.parse(filePath); <add> const parsedPath = path.parse(filePath); <add> const root = parsedPath.root; <add> let dir = parsedPath.dir; <ide> do { <ide> const candidate = path.join(dir, 'package.json'); <ide> if (this._hasteFS.exists(candidate)) { <ide><path>packager/transformer.js <ide> const getBabelRC = (function() { <ide> return babelRC; <ide> } <ide> <del> babelRC = { plugins: [] }; // empty babelrc <add> babelRC = {plugins: []}; // empty babelrc <ide> <ide> // Let's look for the .babelrc in the first project root. <ide> // In the future let's look into adding a command line option to specify <ide> const getBabelRC = (function() { <ide> ); <ide> <ide> // Require the babel-preset's listed in the default babel config <del> babelRC.presets = babelRC.presets.map((preset) => require('babel-preset-' + preset)); <add> babelRC.presets = babelRC.presets.map(preset => require('babel-preset-' + preset)); <ide> babelRC.plugins = resolvePlugins(babelRC.plugins); <ide> } else { <ide> // if we find a .babelrc file we tell babel to use it
23
Ruby
Ruby
add tests for sanitize named bind arity
199d4e28e01ce2e7c54aba69a09557f7b3bf7e4f
<ide><path>activerecord/test/cases/finder_test.rb <ide> def test_named_bind_variables_with_quotes <ide> end <ide> <ide> def test_bind_arity <del> assert_nothing_raised { bind '' } <add> assert_nothing_raised { bind '' } <ide> assert_raise(ActiveRecord::PreparedStatementInvalid) { bind '', 1 } <ide> <ide> assert_raise(ActiveRecord::PreparedStatementInvalid) { bind '?' } <del> assert_nothing_raised { bind '?', 1 } <del> assert_raise(ActiveRecord::PreparedStatementInvalid) { bind '?', 1, 1 } <add> assert_nothing_raised { bind '?', 1 } <add> assert_raise(ActiveRecord::PreparedStatementInvalid) { bind '?', 1, 1 } <ide> end <ide> <ide> def test_named_bind_variables <ide> def test_named_bind_variables <ide> assert_kind_of Time, Topic.where(["id = :id", { id: 1 }]).first.written_on <ide> end <ide> <add> def test_named_bind_arity <add> assert_nothing_raised { bind "name = :name", { name: "37signals" } } <add> assert_nothing_raised { bind "name = :name", { name: "37signals", id: 1 } } <add> assert_raise(ActiveRecord::PreparedStatementInvalid) { bind "name = :name", { id: 1 } } <add> end <add> <ide> class SimpleEnumerable <ide> include Enumerable <ide>
1
Python
Python
add migration doc for legacy_tf_layers/core.py
14336659f21a1dbaa81d3ae23d972049cc0a4f7a
<ide><path>keras/legacy_tf_layers/core.py <ide> class Dense(keras_layers.Dense, base.Layer): <ide> bias_constraint: Constraint function for the bias. <ide> kernel: Weight matrix (TensorFlow variable or tensor). <ide> bias: Bias vector, if applicable (TensorFlow variable or tensor). <add> <add> <add> @compatibility(TF2) <add> This API is not compatible with eager execution or `tf.function`. <add> <add> Please refer to [migration guide] <add> (https://www.tensorflow.org/guide/migrate#models_based_on_tflayers) <add> for more details on migrating a TF1 model to Keras. In TF2 the corresponding <add> layer is `tf.keras.layers.Dense`. <add> <add> <add> #### Structural Mapping to Native TF2 <add> <add> None of the supported arguments have changed name. <add> <add> Before: <add> <add> ```python <add> dense = tf.compat.v1.layers.Dense(units=3) <add> ``` <add> <add> After: <add> <add> ```python <add> dense = tf.keras.layers.Dense(units=3) <add> ``` <add> <add> @end_compatibility <ide> """ <ide> <ide> def __init__(self, units, <ide> def dense( <ide> <ide> Raises: <ide> ValueError: if eager execution is enabled. <add> <add> <add> @compatibility(TF2) <add> This API is not compatible with eager execution or `tf.function`. <add> <add> Please refer to [migration guide] <add> (https://www.tensorflow.org/guide/migrate#models_based_on_tflayers) <add> for more details on migrating a TF1 model to Keras. In TF2 the corresponding <add> layer is `tf.keras.layers.Dense`. <add> <add> <add> #### Structural Mapping to Native TF2 <add> <add> None of the supported arguments have changed name. <add> <add> Before: <add> <add> ```python <add> y = tf.compat.v1.layers.dense(x, units=3) <add> ``` <add> <add> After: <add> <add> ```python <add> y = tf.keras.layers.Dense(units=3)(x) <add> ``` <add> @end_compatibility <add> <ide> """ <ide> warnings.warn('`tf.layers.dense` is deprecated and ' <ide> 'will be removed in a future version. ' <ide> class Dropout(keras_layers.Dropout, base.Layer): <ide> `tf.compat.v1.set_random_seed`. <ide> for behavior. <ide> name: The name of the layer (string). <add> <add> <add> @compatibility(TF2) <add> This API is not compatible with eager execution or `tf.function`. <add> <add> Please refer to [migration guide] <add> (https://www.tensorflow.org/guide/migrate#models_based_on_tflayers) <add> for more details on migrating a TF1 model to Keras. In TF2 the corresponding <add> layer is `tf.keras.layers.Dropout`. <add> <add> <add> #### Structural Mapping to Native TF2 <add> <add> None of the supported arguments have changed name. <add> <add> Before: <add> <add> ```python <add> dropout = tf.compat.v1.layers.Dropout() <add> ``` <add> <add> After: <add> <add> ```python <add> dropout = tf.keras.layers.Dropout() <add> ``` <add> @end_compatibility <ide> """ <ide> <ide> def __init__(self, rate=0.5, <ide> def dropout(inputs, <ide> <ide> Raises: <ide> ValueError: if eager execution is enabled. <add> <add> @compatibility(TF2) <add> This API is not compatible with eager execution or `tf.function`. <add> <add> Please refer to [migration guide] <add> (https://www.tensorflow.org/guide/migrate#models_based_on_tflayers) <add> for more details on migrating a TF1 model to Keras. In TF2 the corresponding <add> layer is `tf.keras.layers.Dropout`. <add> <add> <add> #### Structural Mapping to Native TF2 <add> <add> None of the supported arguments have changed name. <add> <add> Before: <add> <add> ```python <add> y = tf.compat.v1.layers.dropout(x) <add> ``` <add> <add> After: <add> <add> ```python <add> y = tf.keras.layers.Dropout()(x) <add> ``` <add> @end_compatibility <ide> """ <ide> warnings.warn('`tf.layers.dropout` is deprecated and ' <ide> 'will be removed in a future version. ' <ide> class Flatten(keras_layers.Flatten, base.Layer): <ide> y = Flatten()(x) <ide> # now `y` has shape `(None, None)` <ide> ``` <add> <add> @compatibility(TF2) <add> This API is not compatible with eager execution or `tf.function`. <add> <add> Please refer to [migration guide] <add> (https://www.tensorflow.org/guide/migrate#models_based_on_tflayers) <add> for more details on migrating a TF1 model to Keras. In TF2 the corresponding <add> layer is `tf.keras.layers.Flatten`. <add> <add> <add> #### Structural Mapping to Native TF2 <add> <add> None of the supported arguments have changed name. <add> <add> Before: <add> <add> ```python <add> flatten = tf.compat.v1.layers.Flatten() <add> ``` <add> <add> After: <add> <add> ```python <add> flatten = tf.keras.layers.Flatten() <add> ``` <add> @end_compatibility <ide> """ <ide> pass <ide> <ide> def flatten(inputs, name=None, data_format='channels_last'): <ide> y = flatten(x) <ide> # now `y` has shape `(None, None)` <ide> ``` <add> <add> @compatibility(TF2) <add> This API is not compatible with eager execution or`tf.function`. <add> <add> Please refer to [migration guide] <add> (https://www.tensorflow.org/guide/migrate#models_based_on_tflayers) <add> for more details on migrating a TF1 model to Keras. In TF2 the corresponding <add> layer is `tf.keras.layers.Flatten`. <add> <add> <add> #### Structural Mapping to Native TF2 <add> <add> None of the supported arguments have changed name. <add> <add> Before: <add> <add> ```python <add> y = tf.compat.v1.layers.flatten(x) <add> ``` <add> <add> After: <add> <add> ```python <add> y = tf.keras.layers.Flatten()(x) <add> ``` <add> @end_compatibility <ide> """ <ide> warnings.warn('`tf.layers.flatten` is deprecated and ' <ide> 'will be removed in a future version. '
1
Ruby
Ruby
show http method in routing error message
a8870d140ececc6327533d08b112cece03c41499
<ide><path>actionpack/lib/action_dispatch/middleware/show_exceptions.rb <ide> def call(env) <ide> # Only this middleware cares about RoutingError. So, let's just raise <ide> # it here. <ide> if headers['X-Cascade'] == 'pass' <del> raise ActionController::RoutingError, "No route matches #{env['PATH_INFO'].inspect}" <add> raise ActionController::RoutingError, "No route matches [#{env['REQUEST_METHOD']}] #{env['PATH_INFO'].inspect}" <ide> end <ide> rescue Exception => exception <ide> raise exception if env['action_dispatch.show_exceptions'] == false
1
Javascript
Javascript
expose router.transitionto as a public method
d56f929aa0b76f96d5a48c3dc2427041ba943b0f
<ide><path>packages/ember-routing/lib/system/router.js <ide> var EmberRouter = EmberObject.extend(Evented, { <ide> containing a mapping of query parameters <ide> @return {Transition} the transition object associated with this <ide> attempted transition <del> @private <add> @public <ide> */ <ide> transitionTo(...args) { <ide> var queryParams;
1
Javascript
Javascript
bind chunk promises to avoid scope problems
328cfd0246c61aa6cba2b2cd86f2406ebbb1b79e
<ide><path>src/evaluator.js <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> case 'TJ': <ide> var chunkPromise = new Promise(); <ide> chunkPromises.push(chunkPromise); <del> fontPromise.then(function(items, font) { <add> fontPromise.then(function(items, chunkPromise, font) { <ide> var chunk = ''; <ide> for (var j = 0, jj = items.length; j < jj; j++) { <ide> if (typeof items[j] === 'string') { <ide> var PartialEvaluator = (function PartialEvaluatorClosure() { <ide> } <ide> } <ide> } <del> <ide> chunkPromise.resolve( <ide> getBidiText(chunk, -1, font.vertical)); <del> }.bind(null, args[0])); <add> }.bind(null, args[0], chunkPromise)); <ide> break; <ide> case 'Tj': <ide> var chunkPromise = new Promise(); <ide> chunkPromises.push(chunkPromise); <del> fontPromise.then(function(charCodes, font) { <add> fontPromise.then(function(charCodes, chunkPromise, font) { <ide> var chunk = fontCharsToUnicode(charCodes, font); <ide> chunkPromise.resolve( <ide> getBidiText(chunk, -1, font.vertical)); <del> }.bind(null, args[0])); <add> }.bind(null, args[0], chunkPromise)); <ide> break; <ide> case '\'': <ide> // For search, adding a extra white space for line breaks <ide> // would be better here, but that causes too much spaces in <ide> // the text-selection divs. <ide> var chunkPromise = new Promise(); <ide> chunkPromises.push(chunkPromise); <del> fontPromise.then(function(charCodes, font) { <add> fontPromise.then(function(charCodes, chunkPromise, font) { <ide> var chunk = fontCharsToUnicode(charCodes, font); <ide> chunkPromise.resolve( <ide> getBidiText(chunk, -1, font.vertical)); <del> }.bind(null, args[0])); <add> }.bind(null, args[0], chunkPromise)); <ide> break; <ide> case '"': <ide> // Note comment in "'" <ide> var chunkPromise = new Promise(); <ide> chunkPromises.push(chunkPromise); <del> fontPromise.then(function(charCodes, font) { <add> fontPromise.then(function(charCodes, chunkPromise, font) { <ide> var chunk = fontCharsToUnicode(charCodes, font); <ide> chunkPromise.resolve( <ide> getBidiText(chunk, -1, font.vertical)); <del> }.bind(null, args[2])); <add> }.bind(null, args[2], chunkPromise)); <ide> break; <ide> case 'Do': <ide> if (args[0].code) {
1
PHP
PHP
fix remaining failing tests
6d53ecbb54d187d7171459738b5464857e379e7b
<ide><path>lib/Cake/Test/TestCase/Routing/Route/RedirectRouteTest.php <ide> public function setUp() { <ide> * @return void <ide> */ <ide> public function testParsing() { <add> Router::connect('/:controller', array('action' => 'index')); <add> Router::connect('/:controller/:action/*'); <add> <ide> $route = new RedirectRoute('/home', array('controller' => 'posts')); <ide> $route->stop = false; <ide> $route->response = $this->getMock('Cake\Network\Response', array('_sendHeader')); <ide><path>lib/Cake/Test/TestCase/Routing/RouterTest.php <ide> public function testCanLeavePlugin() { <ide> ); <ide> $result = Router::url(array('plugin' => null, 'controller' => 'posts', 'action' => 'index')); <ide> $this->assertEquals('/admin/posts', $result); <del> <del> $this->assertEquals('/admin/other/posts/index', $result); <ide> } <ide> <ide> /**
2
Javascript
Javascript
make menu button title a component
2f0834f43f596211c4d81013d218d86b48d076ca
<ide><path>src/js/menu/menu-button.js <ide> class MenuButton extends Component { <ide> <ide> // Add a title list item to the top <ide> if (this.options_.title) { <del> const title = Dom.createEl('li', { <add> const titleEl = Dom.createEl('li', { <ide> className: 'vjs-menu-title', <ide> innerHTML: toTitleCase(this.options_.title), <ide> tabIndex: -1 <ide> }); <ide> <ide> this.hideThreshold_ += 1; <ide> <del> menu.children_.unshift(title); <del> Dom.prependTo(title, menu.contentEl()); <add> const titleComponent = new Component(this.player_, {el: titleEl}); <add> <add> menu.addItem(titleComponent); <ide> } <ide> <ide> this.items = this.createItems();
1
Ruby
Ruby
convert generic artifact test to spec
24d50599410dacbb36decfc957a5933e19d6a205
<add><path>Library/Homebrew/cask/spec/cask/artifact/generic_artifact_spec.rb <del><path>Library/Homebrew/cask/test/cask/artifact/generic_artifact_test.rb <del>require "test_helper" <add>require "spec_helper" <ide> <ide> describe Hbc::Artifact::Artifact do <ide> let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-generic-artifact.rb") } <ide> let(:target_path) { Hbc.appdir.join("Caffeine.app") } <ide> <ide> before do <del> TestHelper.install_without_artifacts(cask) <add> InstallHelper.install_without_artifacts(cask) <ide> end <ide> <ide> describe "with no target" do <ide> let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-generic-artifact-no-target.rb") } <ide> <ide> it "fails to install with no target" do <del> install_phase.must_raise Hbc::CaskInvalidError <add> expect(install_phase).to raise_error(Hbc::CaskInvalidError) <ide> end <ide> end <ide> <ide> install_phase.call <ide> end <ide> <del> target_path.must_be :directory? <del> source_path.wont_be :exist? <add> expect(target_path).to be_a_directory <add> expect(source_path).not_to exist <ide> end <ide> <ide> it "avoids clobbering an existing artifact" do <ide> target_path.mkpath <ide> <del> assert_raises Hbc::CaskError do <add> expect { <ide> shutup do <ide> install_phase.call <ide> end <del> end <add> }.to raise_error(Hbc::CaskError) <ide> <del> source_path.must_be :directory? <del> target_path.must_be :directory? <del> File.identical?(source_path, target_path).must_equal false <add> expect(source_path).to be_a_directory <add> expect(target_path).to be_a_directory <add> expect(File.identical?(source_path, target_path)).to be false <ide> end <ide> end
1
Javascript
Javascript
add callback to ondidreplaceatomproject
607b3ffe52ab529c337c3e25f00293050ea5dc0c
<ide><path>src/project.js <ide> class Project extends Model { <ide> this.emitter.emit('replaced-atom-project', newSettings) <ide> } <ide> <del> onDidReplaceAtomProject () { <del> return this.emitter.on('replaced-atom-project') <add> onDidReplaceAtomProject (callback) { <add> return this.emitter.on('replaced-atom-project', callback) <ide> } <ide> <ide> clearAtomProject () {
1
Javascript
Javascript
improve performance through bitwise operations
cb62a57d438f94dff32218ba095a6a63b1db958f
<ide><path>src/ng/directive/ngClass.js <ide> function classDirective(name, selector) { <ide> <ide> if (name !== 'ngClass') { <ide> scope.$watch('$index', function($index, old$index) { <del> var mod = $index % 2; <del> if (mod !== old$index % 2) { <del> if (mod == selector) { <add> var mod = $index & 1; <add> if (mod !== old$index & 1) { <add> if (mod === selector) { <ide> addClass(scope.$eval(attr[name])); <ide> } else { <ide> removeClass(scope.$eval(attr[name]));
1
Text
Text
remove duplicate contributing.md
a7fe1ae2c25588149094d7f74209f3974c224cf6
<ide><path>project/CONTRIBUTING.md <del>../CONTRIBUTING.md <ide>\ No newline at end of file
1
Python
Python
remove kwargs argument from ibert mlm forward pass
c85547af2b69f9082bcd7bac97092b1d162f3fdc
<ide><path>src/transformers/models/ibert/modeling_ibert.py <ide> def forward( <ide> output_attentions: Optional[bool] = None, <ide> output_hidden_states: Optional[bool] = None, <ide> return_dict: Optional[bool] = None, <del> **kwargs, <ide> ) -> Union[MaskedLMOutput, Tuple[torch.FloatTensor]]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1
Text
Text
update changelog with 9.x eol
195480a8bc3a7ffca675210b260086f979e8f4de
<ide><path>CHANGELOG.md <ide> release lines. <ide> <ide> Select a Node.js version below to view the changelog history: <ide> <del>* [Node.js 10](doc/changelogs/CHANGELOG_V10.md) <del>* [Node.js 9](doc/changelogs/CHANGELOG_V9.md) <del>* [Node.js 8](doc/changelogs/CHANGELOG_V8.md) <del>* [Node.js 7](doc/changelogs/CHANGELOG_V7.md) <del>* [Node.js 6](doc/changelogs/CHANGELOG_V6.md) <del>* [Node.js 5](doc/changelogs/CHANGELOG_V5.md) <del>* [Node.js 4](doc/changelogs/CHANGELOG_V4.md) <del>* [io.js](doc/changelogs/CHANGELOG_IOJS.md) <del>* [Node.js 0.12](doc/changelogs/CHANGELOG_V012.md) <del>* [Node.js 0.10](doc/changelogs/CHANGELOG_V010.md) <add>* [Node.js 10](doc/changelogs/CHANGELOG_V10.md) — **Current** <add>* [Node.js 9](doc/changelogs/CHANGELOG_V9.md) — End-of-Life <add>* [Node.js 8](doc/changelogs/CHANGELOG_V8.md) — **Long Term Support** <add>* [Node.js 7](doc/changelogs/CHANGELOG_V7.md) — End-of-Life <add>* [Node.js 6](doc/changelogs/CHANGELOG_V6.md) — Long Term Support <add>* [Node.js 5](doc/changelogs/CHANGELOG_V5.md) — End-of-Life <add>* [Node.js 4](doc/changelogs/CHANGELOG_V4.md) — End-of-Life <add>* [io.js](doc/changelogs/CHANGELOG_IOJS.md) — End-of-Life <add>* [Node.js 0.12](doc/changelogs/CHANGELOG_V012.md) — End-of-Life <add>* [Node.js 0.10](doc/changelogs/CHANGELOG_V010.md) — End-of-Life <ide> * [Archive](doc/changelogs/CHANGELOG_ARCHIVE.md) <ide> <ide> Please use the following table to find the changelog for a specific Node.js <ide> release. <ide> <table> <ide> <tr> <ide> <th title="Current"><a href="doc/changelogs/CHANGELOG_V10.md">10</a><sup>Current</sup></th> <del> <th><a href="doc/changelogs/CHANGELOG_V9.md">9</a></th> <ide> <th title="LTS Until 2019-12"><a href="doc/changelogs/CHANGELOG_V8.md">8</a><sup>LTS</sup></th> <ide> <th title="LTS Until 2019-04"><a href="doc/changelogs/CHANGELOG_V6.md">6</a><sup>LTS</sup></th> <del> <th title="End-of-life since 2018-05-01"><a href="doc/changelogs/CHANGELOG_V4.md">4</a><sup>EOL</sup></th> <ide> </tr> <ide> <tr> <ide> <td valign="top"> <ide> release. <ide> <a href="doc/changelogs/CHANGELOG_V10.md#10.0.0">10.0.0</a><br/> <ide> </td> <ide> <td valign="top"> <del><b><a href="doc/changelogs/CHANGELOG_V9.md#9.11.2">9.11.2</a></b><br/> <del><a href="doc/changelogs/CHANGELOG_V9.md#9.11.1">9.11.1</a><br/> <del><a href="doc/changelogs/CHANGELOG_V9.md#9.11.0">9.11.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V9.md#9.10.1">9.10.1</a><br/> <del><a href="doc/changelogs/CHANGELOG_V9.md#9.10.0">9.10.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V9.md#9.9.0">9.9.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V9.md#9.8.0">9.8.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V9.md#9.7.1">9.7.1</a><br/> <del><a href="doc/changelogs/CHANGELOG_V9.md#9.7.0">9.7.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V9.md#9.6.1">9.6.1</a><br/> <del><a href="doc/changelogs/CHANGELOG_V9.md#9.6.0">9.6.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V9.md#9.5.0">9.5.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V9.md#9.4.0">9.4.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V9.md#9.3.0">9.3.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V9.md#9.2.1">9.2.1</a><br/> <del><a href="doc/changelogs/CHANGELOG_V9.md#9.2.0">9.2.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V9.md#9.1.0">9.1.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V9.md#9.0.0">9.0.0</a><br/> <del> </td> <del> <td valign="top"> <ide> <b><a href="doc/changelogs/CHANGELOG_V8.md#8.11.3">8.11.3</a></b><br/> <ide> <a href="doc/changelogs/CHANGELOG_V8.md#8.11.2">8.11.2</a><br/> <ide> <a href="doc/changelogs/CHANGELOG_V8.md#8.11.1">8.11.1</a><br/> <ide> release. <ide> <a href="doc/changelogs/CHANGELOG_V6.md#6.1.0">6.1.0</a><br/> <ide> <a href="doc/changelogs/CHANGELOG_V6.md#6.0.0">6.0.0</a><br/> <ide> </td> <del> <td valign="top"> <del><b><a href="doc/changelogs/CHANGELOG_V4.md#4.9.1">4.9.1</a></b><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.9.0">4.9.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.8.7">4.8.7</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.8.6">4.8.6</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.8.5">4.8.5</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.8.4">4.8.4</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.8.3">4.8.3</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.8.2">4.8.2</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.8.1">4.8.1</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.8.0">4.8.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.7.3">4.7.3</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.7.2">4.7.2</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.7.1">4.7.1</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.7.0">4.7.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.6.1">4.6.2</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.6.1">4.6.1</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.6.0">4.6.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.5.0">4.5.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.4.7">4.4.7</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.4.6">4.4.6</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.4.5">4.4.5</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.4.4">4.4.4</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.4.3">4.4.3</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.4.2">4.4.2</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.4.1">4.4.1</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.4.0">4.4.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.3.2">4.3.2</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.3.1">4.3.1</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.3.0">4.3.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.2.6">4.2.6</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.2.5">4.2.5</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.2.4">4.2.4</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.2.3">4.2.3</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.2.2">4.2.2</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.2.1">4.2.1</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.2.0">4.2.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.1.2">4.1.2</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.1.1">4.1.1</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.1.0">4.1.0</a><br/> <del><a href="doc/changelogs/CHANGELOG_V4.md#4.0.0">4.0.0</a><br/> <del> </td> <ide> </tr> <ide> </table> <ide> <ide> ### Notes <ide> <ide> * Release streams marked with `LTS` are currently covered by the <del> [Node.js Long Term Support plan](https://github.com/nodejs/LTS). <add> [Node.js Long Term Support plan](https://github.com/nodejs/Release). <ide> * Release versions displayed in **bold** text represent the most <ide> recent actively supported release. <ide>
1
Javascript
Javascript
add tests for contextdependencytemplateasid
6ada39f0a516a58e5b7afae756dde9c09f9a3a07
<ide><path>test/ContextDependencyTemplateAsId.test.js <add>"use strict"; <add> <add>const _ = require("lodash"); <add>const should = require("should"); <add>const sinon = require("sinon"); <add>const ContextDependencyTemplateAsId = require("../lib/dependencies/ContextDependencyTemplateAsId"); <add> <add>const requestShortenerMock = { <add> shorten: (request) => `shortened ${request}` <add>}; <add> <add>describe("ContextDependencyTemplateAsId", () => { <add> let env; <add> <add> const applyContextDependencyTemplateAsId = function() { <add> const contextDependencyTemplateAsId = new ContextDependencyTemplateAsId(); <add> const args = [].slice.call(arguments).concat(requestShortenerMock); <add> contextDependencyTemplateAsId.apply.apply(contextDependencyTemplateAsId, args); <add> }; <add> <add> beforeEach(() => { <add> env = { <add> source: { <add> replace: sinon.stub() <add> }, <add> outputOptions: { <add> pathinfo: true <add> }, <add> module: { <add> id: "123", <add> dependencies: [ <add> "myModuleDependency" <add> ] <add> }, <add> baseDependency: { <add> range: [1, 25], <add> request: "myModule" <add> } <add> }; <add> }); <add> <add> it("has apply function", () => { <add> (new ContextDependencyTemplateAsId()).apply.should.be.a.Function(); <add> }); <add> <add> describe("when applied", () => { <add> describe("with module missing depedencies", () => { <add> beforeEach(() => { <add> applyContextDependencyTemplateAsId(env.baseDependency, env.source, env.outputOptions); <add> }); <add> <add> it("replaces source with missing module error", () => { <add> env.source.replace.callCount.should.be.exactly(1); <add> sinon.assert.calledWith(env.source.replace, 1, 24, '!(function webpackMissingModule() { var e = new Error("Cannot find module \\"myModule\\""); e.code = \'MODULE_NOT_FOUND\';; throw e; }())'); <add> }); <add> }); <add> <add> describe("with module which does not have a value range", () => { <add> beforeEach(() => { <add> env.dependency = _.extend(env.baseDependency, { <add> prepend: "prepend value", <add> module: env.module <add> }); <add> }); <add> <add> describe("and path info true", function() { <add> beforeEach(function() { <add> env.outputOptions.pathinfo = true; <add> applyContextDependencyTemplateAsId(env.dependency, env.source, env.outputOptions); <add> }); <add> <add> it("replaces source with webpack require with comment", () => { <add> env.source.replace.callCount.should.be.exactly(1); <add> sinon.assert.calledWith(env.source.replace, 1, 24, '__webpack_require__(/*! shortened myModule */ "123").resolve'); <add> }); <add> }); <add> <add> describe("and path info false", function() { <add> beforeEach(function() { <add> env.outputOptions.pathinfo = false; <add> applyContextDependencyTemplateAsId(env.dependency, env.source, env.outputOptions); <add> }); <add> <add> it("replaces source with webpack require without comment", () => { <add> env.source.replace.callCount.should.be.exactly(1); <add> sinon.assert.calledWith(env.source.replace, 1, 24, '__webpack_require__("123").resolve'); <add> }); <add> }); <add> }); <add> <add> describe("with module which has a value range", () => { <add> describe("with no replacements", () => { <add> beforeEach(() => { <add> const dependency = _.extend(env.baseDependency, { <add> valueRange: [8, 18], <add> prepend: "prepend value", <add> module: env.module <add> }); <add> <add> applyContextDependencyTemplateAsId(dependency, env.source, env.outputOptions); <add> }); <add> <add> it("replaces source with webpack require and wraps value", () => { <add> env.source.replace.callCount.should.be.exactly(2); <add> sinon.assert.calledWith(env.source.replace, 18, 24, ")"); <add> sinon.assert.calledWith(env.source.replace, 1, 7, '__webpack_require__(/*! shortened myModule */ "123").resolve("prepend value"'); <add> }); <add> }); <add> <add> describe("with replacements", () => { <add> beforeEach(() => { <add> const dependency = _.extend(env.baseDependency, { <add> valueRange: [8, 18], <add> replaces: [{ <add> value: "foo", <add> range: [9, 11] <add> }, <add> { <add> value: "bar", <add> range: [13, 15] <add> } <add> ], <add> prepend: "prepend value", <add> module: env.module <add> }); <add> <add> applyContextDependencyTemplateAsId(dependency, env.source, env.outputOptions); <add> }); <add> <add> it("replaces source with webpack require, wraps value and make replacements", () => { <add> env.source.replace.callCount.should.be.exactly(4); <add> sinon.assert.calledWith(env.source.replace, 9, 10, "foo"); <add> sinon.assert.calledWith(env.source.replace, 13, 14, "bar"); <add> sinon.assert.calledWith(env.source.replace, 18, 24, ")"); <add> sinon.assert.calledWith(env.source.replace, 1, 7, '__webpack_require__(/*! shortened myModule */ "123").resolve("prepend value"'); <add> }); <add> }); <add> }); <add> }); <add>});
1
PHP
PHP
fix a link
d90b33f38181fda28f029cb8a5788fd8413847c8
<ide><path>src/Auth/DefaultPasswordHasher.php <ide> class DefaultPasswordHasher extends AbstractPasswordHasher <ide> * <ide> * @param string $password Plain text password to hash. <ide> * @return bool|string Password hash or false on failure <del> * @link https://book.cakephp.org/3.0/en/core-libraries/components/authentication.html#hashing-passwords <add> * @link https://book.cakephp.org/3.0/en/controllers/components/authentication.html#hashing-passwords <ide> */ <ide> public function hash($password) <ide> {
1
Javascript
Javascript
add path to spawn enoent error
f09b02786ffd1f987df623aa670c26216b0682c9
<ide><path>lib/child_process.js <ide> function ChildProcess() { <ide> this.signalCode = null; <ide> this.exitCode = null; <ide> this.killed = false; <add> this.spawnfile = null; <ide> <ide> this._handle = new Process(); <ide> this._handle.owner = this; <ide> function ChildProcess() { <ide> // <ide> // - spawn failures are reported with exitCode < 0 <ide> // <del> var err = (exitCode < 0) ? errnoException(exitCode, 'spawn') : null; <add> var syscall = self.spawnfile ? 'spawn ' + self.spawnfile : 'spawn'; <add> var err = (exitCode < 0) ? errnoException(exitCode, syscall) : null; <ide> <ide> if (signalCode) { <ide> self.signalCode = signalCode; <ide> function ChildProcess() { <ide> self._handle = null; <ide> <ide> if (exitCode < 0) { <add> if (self.spawnfile) <add> err.path = self.spawnfile; <add> <ide> self.emit('error', err); <ide> } else { <ide> self.emit('exit', self.exitCode, self.signalCode); <ide> ChildProcess.prototype.spawn = function(options) { <ide> options.envPairs.push('NODE_CHANNEL_FD=' + ipcFd); <ide> } <ide> <add> this.spawnfile = options.file; <add> <ide> var err = this._handle.spawn(options); <ide> <ide> if (err == uv.UV_ENOENT) { <ide><path>test/simple/test-child-process-spawn-error.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 fs = require('fs'); <add>var spawn = require('child_process').spawn; <add>var assert = require('assert'); <add> <add>var errors = 0; <add> <add>var enoentPath = 'foo123'; <add>assert.equal(fs.existsSync(enoentPath), false); <add> <add>var enoentChild = spawn(enoentPath); <add>enoentChild.on('error', function (err) { <add> assert.equal(err.path, enoentPath); <add> errors++; <add>}); <add> <add>process.on('exit', function() { <add> assert.equal(1, errors); <add>});
2
Javascript
Javascript
support the `type == all` properly
6718500eaaeb92b8a74320dcee961ac96f6f12fa
<ide><path>packages/react-native-codegen/src/generators/RNCodegen.js <ide> type LibraryOptions = $ReadOnly<{ <ide> outputDirectory: string, <ide> packageName?: string, // Some platforms have a notion of package, which should be configurable. <ide> assumeNonnull: boolean, <add> componentsOutputDir?: string, // optional for backward compatibility <add> modulesOutputDir?: string, // optional for backward compatibility <ide> }>; <ide> <ide> type SchemasOptions = $ReadOnly<{ <ide> const SCHEMAS_GENERATORS = { <ide> ], <ide> }; <ide> <del>function writeMapToFiles(map: Map<string, string>, outputDir: string) { <add>type CodeGenFile = { <add> name: string, <add> content: string, <add> outputDir: string, <add>}; <add> <add>function writeMapToFiles(map: Array<CodeGenFile>) { <ide> let success = true; <del> map.forEach((contents: string, fileName: string) => { <add> map.forEach(file => { <ide> try { <del> const location = path.join(outputDir, fileName); <add> const location = path.join(file.outputDir, file.name); <ide> const dirName = path.dirname(location); <ide> if (!fs.existsSync(dirName)) { <ide> fs.mkdirSync(dirName, {recursive: true}); <ide> } <del> fs.writeFileSync(location, contents); <add> fs.writeFileSync(location, file.content); <ide> } catch (error) { <ide> success = false; <del> console.error(`Failed to write ${fileName} to ${outputDir}`, error); <add> console.error(`Failed to write ${file.name} to ${file.outputDir}`, error); <ide> } <ide> }); <ide> <ide> return success; <ide> } <ide> <del>function checkFilesForChanges( <del> map: Map<string, string>, <del> outputDir: string, <del>): boolean { <add>function checkFilesForChanges(generated: Array<CodeGenFile>): boolean { <ide> let hasChanged = false; <ide> <del> map.forEach((contents: string, fileName: string) => { <del> const location = path.join(outputDir, fileName); <add> generated.forEach(file => { <add> const location = path.join(file.outputDir, file.name); <ide> const currentContents = fs.readFileSync(location, 'utf8'); <del> if (currentContents !== contents) { <del> console.error(`- ${fileName} has changed`); <add> if (currentContents !== file.content) { <add> console.error(`- ${file.name} has changed`); <ide> <ide> hasChanged = true; <ide> } <ide> function checkFilesForChanges( <ide> return !hasChanged; <ide> } <ide> <add>function checkOrWriteFiles( <add> generatedFiles: Array<CodeGenFile>, <add> test: void | boolean, <add>): boolean { <add> if (test === true) { <add> return checkFilesForChanges(generatedFiles); <add> } <add> return writeMapToFiles(generatedFiles); <add>} <add> <ide> module.exports = { <ide> generate( <ide> { <ide> module.exports = { <ide> outputDirectory, <ide> packageName, <ide> assumeNonnull, <add> componentsOutputDir, <add> modulesOutputDir, <ide> }: LibraryOptions, <ide> {generators, test}: LibraryConfig, <ide> ): boolean { <ide> schemaValidator.validate(schema); <ide> <del> const generatedFiles = []; <add> const outputFoldersForGenerators = { <add> componentsIOS: componentsOutputDir ?? outputDirectory, // fallback for backward compatibility <add> modulesIOS: modulesOutputDir ?? outputDirectory, // fallback for backward compatibility <add> descriptors: outputDirectory, <add> events: outputDirectory, <add> props: outputDirectory, <add> componentsAndroid: outputDirectory, <add> modulesAndroid: outputDirectory, <add> modulesCxx: outputDirectory, <add> tests: outputDirectory, <add> 'shadow-nodes': outputDirectory, <add> }; <add> <add> const generatedFiles: Array<CodeGenFile> = []; <add> <ide> for (const name of generators) { <ide> for (const generator of LIBRARY_GENERATORS[name]) { <del> generatedFiles.push( <del> ...generator(libraryName, schema, packageName, assumeNonnull), <add> generator(libraryName, schema, packageName, assumeNonnull).forEach( <add> (contents: string, fileName: string) => { <add> generatedFiles.push({ <add> name: fileName, <add> content: contents, <add> outputDir: outputFoldersForGenerators[name], <add> }); <add> }, <ide> ); <ide> } <ide> } <del> <del> const filesToUpdate = new Map([...generatedFiles]); <del> <del> if (test === true) { <del> return checkFilesForChanges(filesToUpdate, outputDirectory); <del> } <del> <del> return writeMapToFiles(filesToUpdate, outputDirectory); <add> return checkOrWriteFiles(generatedFiles, test); <ide> }, <ide> generateFromSchemas( <ide> {schemas, outputDirectory}: SchemasOptions, <ide> module.exports = { <ide> schemaValidator.validate(schemas[libraryName]), <ide> ); <ide> <del> const generatedFiles = []; <add> const generatedFiles: Array<CodeGenFile> = []; <add> <ide> for (const name of generators) { <ide> for (const generator of SCHEMAS_GENERATORS[name]) { <del> generatedFiles.push(...generator(schemas)); <add> generator(schemas).forEach((contents: string, fileName: string) => { <add> generatedFiles.push({ <add> name: fileName, <add> content: contents, <add> outputDir: outputDirectory, <add> }); <add> }); <ide> } <ide> } <del> <del> const filesToUpdate = new Map([...generatedFiles]); <del> <del> if (test === true) { <del> return checkFilesForChanges(filesToUpdate, outputDirectory); <del> } <del> <del> return writeMapToFiles(filesToUpdate, outputDirectory); <add> return checkOrWriteFiles(generatedFiles, test); <ide> }, <ide> generateViewConfig({libraryName, schema}: LibraryOptions): string { <ide> schemaValidator.validate(schema); <ide><path>packages/react-native-codegen/src/generators/__test_fixtures__/fixtures.js <add>/** <add> * Copyright (c) Meta Platforms, Inc. and affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @flow strict-local <add> * @format <add> */ <add> <add>'use strict'; <add> <add>import type {SchemaType} from '../../CodegenSchema.js'; <add> <add>const SCHEMA_WITH_TM_AND_FC: SchemaType = { <add> modules: { <add> ColoredView: { <add> type: 'Component', <add> components: { <add> ColoredView: { <add> extendsProps: [ <add> { <add> type: 'ReactNativeBuiltInType', <add> knownTypeName: 'ReactNativeCoreViewProps', <add> }, <add> ], <add> events: [], <add> props: [ <add> { <add> name: 'color', <add> optional: false, <add> typeAnnotation: { <add> type: 'StringTypeAnnotation', <add> default: null, <add> }, <add> }, <add> ], <add> commands: [], <add> }, <add> }, <add> }, <add> NativeCalculator: { <add> type: 'NativeModule', <add> aliases: {}, <add> spec: { <add> properties: [ <add> { <add> name: 'add', <add> optional: false, <add> typeAnnotation: { <add> type: 'FunctionTypeAnnotation', <add> returnTypeAnnotation: { <add> type: 'PromiseTypeAnnotation', <add> }, <add> params: [ <add> { <add> name: 'a', <add> optional: false, <add> typeAnnotation: { <add> type: 'NumberTypeAnnotation', <add> }, <add> }, <add> { <add> name: 'b', <add> optional: false, <add> typeAnnotation: { <add> type: 'NumberTypeAnnotation', <add> }, <add> }, <add> ], <add> }, <add> }, <add> ], <add> }, <add> moduleNames: ['Calculator'], <add> }, <add> }, <add>}; <add> <add>module.exports = { <add> all: SCHEMA_WITH_TM_AND_FC, <add>}; <ide><path>packages/react-native-codegen/src/generators/__tests__/RNCodegen-test.js <add>/** <add> * Copyright (c) Meta Platforms, Inc. and affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @emails oncall+react_native <add> * @flow strict-local <add> * @format <add> */ <add> <add>'use strict'; <add> <add>const rnCodegen = require('../RNCodegen.js'); <add>const fixture = require('../__test_fixtures__/fixtures.js'); <add>const path = require('path'); <add> <add>const invalidDirectory = 'invalid/'; <add>const packageName = 'na'; <add>const componentsOutputDir = 'react/renderer/components/library'; <add>const modulesOutputDir = 'library'; <add> <add>describe('RNCodegen.generate', () => { <add> it('when type `all`', () => { <add> const expectedPaths = { <add> 'library.h': modulesOutputDir, <add> 'library-generated.mm': modulesOutputDir, <add> 'ShadowNodes.h': componentsOutputDir, <add> 'ShadowNodes.cpp': componentsOutputDir, <add> 'Props.h': componentsOutputDir, <add> 'Props.cpp': componentsOutputDir, <add> 'RCTComponentViewHelpers.h': componentsOutputDir, <add> 'EventEmitters.h': componentsOutputDir, <add> 'EventEmitters.cpp': componentsOutputDir, <add> 'ComponentDescriptors.h': componentsOutputDir, <add> }; <add> <add> jest.mock('fs', () => ({ <add> existsSync: location => { <add> return true; <add> }, <add> writeFileSync: (location, content) => { <add> let receivedDir = path.dirname(location); <add> let receivedBasename = path.basename(location); <add> <add> let expectedPath = expectedPaths[receivedBasename]; <add> expect(receivedDir).toEqual(expectedPath); <add> }, <add> })); <add> <add> const res = rnCodegen.generate( <add> { <add> libraryName: 'library', <add> schema: fixture.all, <add> outputDirectory: invalidDirectory, <add> packageName: packageName, <add> assumeNonnull: true, <add> componentsOutputDir: componentsOutputDir, <add> modulesOutputDir: modulesOutputDir, <add> }, <add> { <add> generators: ['componentsIOS', 'modulesIOS'], <add> test: false, <add> }, <add> ); <add> <add> expect(res).toBeTruthy(); <add> }); <add>}); <ide><path>scripts/generate-artifacts.js <ide> function executeNodeScript(script) { <ide> execSync(`${NODE} ${script}`); <ide> } <ide> <add>function isDirEmpty(dirPath) { <add> return fs.readdirSync(dirPath).length === 0; <add>} <add> <ide> function main(appRootDir, outputPath) { <ide> if (appRootDir == null) { <ide> console.error('Missing path to React Native application'); <ide> function main(appRootDir, outputPath) { <ide> library.libraryPath, <ide> library.config.jsSrcsDir, <ide> ); <del> const pathToOutputDirIOS = path.join( <del> iosOutputDir, <del> library.config.type === 'components' <del> ? 'react/renderer/components' <del> : './', <del> library.config.name, <del> ); <del> const pathToTempOutputDir = path.join(tmpDir, 'out'); <add> function composePath(intermediate) { <add> return path.join(iosOutputDir, intermediate, library.config.name); <add> } <add> <add> const outputDirsIOS = { <add> components: composePath('react/renderer/components'), <add> nativeModules: composePath('./'), <add> }; <add> <add> const tempOutputDirs = { <add> components: path.join(tmpDir, 'out', 'components'), <add> nativeModules: path.join(tmpDir, 'out', 'nativeModules'), <add> }; <ide> <ide> console.log(`\n\n[Codegen] >>>>> Processing ${library.config.name}`); <ide> // Generate one schema for the entire library... <ide> function main(appRootDir, outputPath) { <ide> const libraryTypeArg = library.config.type <ide> ? `--libraryType ${library.config.type}` <ide> : ''; <del> fs.mkdirSync(pathToTempOutputDir, {recursive: true}); <add> <add> Object.entries(tempOutputDirs).forEach(([type, dirPath]) => { <add> fs.mkdirSync(dirPath, {recursive: true}); <add> }); <add> <add> const deprecated_outputDir = <add> library.config.type === 'components' <add> ? tempOutputDirs.components <add> : tempOutputDirs.nativeModules; <add> <ide> executeNodeScript( <del> `${path.join( <del> RN_ROOT, <del> 'scripts', <del> 'generate-specs-cli.js', <del> )} --platform ios --schemaPath ${pathToSchema} --outputDir ${pathToTempOutputDir} --libraryName ${ <del> library.config.name <del> } ${libraryTypeArg}`, <add> `${path.join(RN_ROOT, 'scripts', 'generate-specs-cli.js')} \ <add> --platform ios \ <add> --schemaPath ${pathToSchema} \ <add> --outputDir ${deprecated_outputDir} \ <add> --componentsOutputDir ${tempOutputDirs.components} \ <add> --modulesOutputDirs ${tempOutputDirs.nativeModules} \ <add> --libraryName ${library.config.name} \ <add> ${libraryTypeArg}`, <ide> ); <ide> <ide> // Finally, copy artifacts to the final output directory. <del> fs.mkdirSync(pathToOutputDirIOS, {recursive: true}); <del> execSync(`cp -R ${pathToTempOutputDir}/* ${pathToOutputDirIOS}`); <del> console.log(`[Codegen] Generated artifacts: ${pathToOutputDirIOS}`); <add> Object.entries(outputDirsIOS).forEach(([type, dirPath]) => { <add> const outDir = tempOutputDirs[type]; <add> if (isDirEmpty(outDir)) { <add> return; // cp fails if we try to copy something empty. <add> } <add> <add> fs.mkdirSync(dirPath, {recursive: true}); <add> execSync(`cp -R ${outDir}/* ${dirPath}`); <add> console.log(`[Codegen] Generated artifacts: ${dirPath}`); <add> }); <ide> <ide> // Filter the react native core library out. <ide> // In the future, core library and third party library should <ide><path>scripts/generate-specs-cli.js <ide> const argv = yargs <ide> .option('o', { <ide> alias: 'outputDir', <ide> describe: <del> 'Path to directory where native code source files should be saved.', <add> 'DEPRECATED - Path to directory where native code source files should be saved.', <ide> }) <ide> .option('n', { <ide> alias: 'libraryName', <ide> const argv = yargs <ide> describe: 'all, components, or modules.', <ide> default: 'all', <ide> }) <add> .option('c', { <add> alias: 'componentsOutputDir', <add> describe: 'Output directory for the codeGen for Fabric Components', <add> }) <add> .option('m', { <add> alias: 'modulesOutputDirs', <add> describe: 'Output directory for the codeGen for TurboModules', <add> }) <ide> .usage('Usage: $0 <args>') <ide> .demandOption( <ide> ['platform', 'schemaPath', 'outputDir'], <ide> const GENERATORS = { <ide> }, <ide> }; <ide> <del>function generateSpec( <del> platform, <del> schemaPath, <add>function deprecated_createOutputDirectoryIfNeeded( <ide> outputDirectory, <ide> libraryName, <del> packageName, <del> libraryType, <ide> ) { <add> if (!outputDirectory) { <add> outputDirectory = path.resolve(__dirname, '..', 'Libraries', libraryName); <add> } <add> mkdirp.sync(outputDirectory); <add>} <add> <add>function createFolderIfDefined(folder) { <add> if (folder) { <add> mkdirp.sync(folder); <add> } <add>} <add> <add>/** <add> * This function read a JSON schema from a path and parses it. <add> * It throws if the schema don't exists or it can't be parsed. <add> * <add> * @parameter schemaPath: the path to the schema <add> * @return a valid schema <add> * @throw an Error if the schema doesn't exists in a given path or if it can't be parsed. <add> */ <add>function readAndParseSchema(schemaPath) { <ide> const schemaText = fs.readFileSync(schemaPath, 'utf-8'); <ide> <ide> if (schemaText == null) { <ide> throw new Error(`Can't find schema at ${schemaPath}`); <ide> } <ide> <del> if (!outputDirectory) { <del> outputDirectory = path.resolve(__dirname, '..', 'Libraries', libraryName); <del> } <del> mkdirp.sync(outputDirectory); <del> <del> let schema; <ide> try { <del> schema = JSON.parse(schemaText); <add> return JSON.parse(schemaText); <ide> } catch (err) { <ide> throw new Error(`Can't parse schema to JSON. ${schemaPath}`); <ide> } <add>} <ide> <add>function validateLibraryType(libraryType) { <ide> if (GENERATORS[libraryType] == null) { <ide> throw new Error(`Invalid library type. ${libraryType}`); <ide> } <add>} <add> <add>function generateSpec( <add> platform, <add> schemaPath, <add> outputDirectory, <add> libraryName, <add> packageName, <add> libraryType, <add> componentsOutputDir, <add> modulesOutputDirs, <add>) { <add> validateLibraryType(libraryType); <add> <add> let schema = readAndParseSchema(schemaPath); <add> <add> createFolderIfDefined(componentsOutputDir); <add> createFolderIfDefined(modulesOutputDirs); <add> deprecated_createOutputDirectoryIfNeeded(outputDirectory, libraryName); <ide> <ide> RNCodegen.generate( <ide> { <ide> libraryName, <ide> schema, <ide> outputDirectory, <ide> packageName, <add> componentsOutputDir, <add> modulesOutputDirs, <ide> }, <ide> { <ide> generators: GENERATORS[libraryType][platform], <ide> function main() { <ide> argv.libraryName, <ide> argv.javaPackageName, <ide> argv.libraryType, <add> argv.componentsOutputDir, <add> argv.modulesOutputDirs, <ide> ); <ide> } <ide>
5
Javascript
Javascript
replace var with let/const
a412a97a73b8325b057bc749cffdd3c6c014ebe9
<ide><path>lib/zlib.js <ide> const codes = { <ide> }; <ide> <ide> const ckeys = ObjectKeys(codes); <del>for (var ck = 0; ck < ckeys.length; ck++) { <del> var ckey = ckeys[ck]; <add>for (let ck = 0; ck < ckeys.length; ck++) { <add> const ckey = ckeys[ck]; <ide> codes[codes[ckey]] = ckey; <ide> } <ide> <ide> function zlibBufferOnError(err) { <ide> } <ide> <ide> function zlibBufferOnEnd() { <del> var buf; <del> var err; <add> let buf; <add> let err; <ide> if (this.nread >= kMaxLength) { <ide> err = new ERR_BUFFER_TOO_LARGE(); <ide> } else if (this.nread === 0) { <ide> buf = Buffer.alloc(0); <ide> } else { <del> var bufs = this.buffers; <add> const bufs = this.buffers; <ide> buf = (bufs.length === 1 ? bufs[0] : Buffer.concat(bufs, this.nread)); <ide> } <ide> this.close(); <ide> const checkRangesOrGetDefault = hideStackFrames( <ide> <ide> // The base class for all Zlib-style streams. <ide> function ZlibBase(opts, mode, handle, { flush, finishFlush, fullFlush }) { <del> var chunkSize = Z_DEFAULT_CHUNK; <add> let chunkSize = Z_DEFAULT_CHUNK; <ide> // The ZlibBase class is not exported to user land, the mode should only be <ide> // passed in by us. <ide> assert(typeof mode === 'number'); <ide> ZlibBase.prototype._destroy = function(err, callback) { <ide> }; <ide> <ide> ZlibBase.prototype._transform = function(chunk, encoding, cb) { <del> var flushFlag = this._defaultFlushFlag; <add> let flushFlag = this._defaultFlushFlag; <ide> // We use a 'fake' zero-length chunk to carry information about flushes from <ide> // the public API to the actual stream implementation. <ide> if (typeof chunk[kFlushFlag] === 'number') { <ide> ZlibBase.prototype._processChunk = function(chunk, flushFlag, cb) { <ide> }; <ide> <ide> function processChunkSync(self, chunk, flushFlag) { <del> var availInBefore = chunk.byteLength; <del> var availOutBefore = self._chunkSize - self._outOffset; <del> var inOff = 0; <del> var availOutAfter; <del> var availInAfter; <del> <del> var buffers = null; <del> var nread = 0; <del> var inputRead = 0; <add> let availInBefore = chunk.byteLength; <add> let availOutBefore = self._chunkSize - self._outOffset; <add> let inOff = 0; <add> let availOutAfter; <add> let availInAfter; <add> <add> let buffers = null; <add> let nread = 0; <add> let inputRead = 0; <ide> const state = self._writeState; <ide> const handle = self._handle; <del> var buffer = self._outBuffer; <del> var offset = self._outOffset; <add> let buffer = self._outBuffer; <add> let offset = self._outOffset; <ide> const chunkSize = self._chunkSize; <ide> <del> var error; <add> let error; <ide> self.on('error', function onError(er) { <ide> error = er; <ide> }); <ide> function processChunkSync(self, chunk, flushFlag) { <ide> availOutAfter = state[0]; <ide> availInAfter = state[1]; <ide> <del> var inDelta = (availInBefore - availInAfter); <add> const inDelta = (availInBefore - availInAfter); <ide> inputRead += inDelta; <ide> <del> var have = availOutBefore - availOutAfter; <add> const have = availOutBefore - availOutAfter; <ide> if (have > 0) { <del> var out = buffer.slice(offset, offset + have); <add> const out = buffer.slice(offset, offset + have); <ide> offset += have; <ide> if (!buffers) <ide> buffers = [out]; <ide> function processCallback() { <ide> <ide> const have = handle.availOutBefore - availOutAfter; <ide> if (have > 0) { <del> var out = self._outBuffer.slice(self._outOffset, self._outOffset + have); <add> const out = self._outBuffer.slice(self._outOffset, self._outOffset + have); <ide> self._outOffset += have; <ide> self.push(out); <ide> } else { <ide> const zlibDefaultOpts = { <ide> // Base class for all streams actually backed by zlib and using zlib-specific <ide> // parameters. <ide> function Zlib(opts, mode) { <del> var windowBits = Z_DEFAULT_WINDOWBITS; <del> var level = Z_DEFAULT_COMPRESSION; <del> var memLevel = Z_DEFAULT_MEMLEVEL; <del> var strategy = Z_DEFAULT_STRATEGY; <del> var dictionary; <add> let windowBits = Z_DEFAULT_WINDOWBITS; <add> let level = Z_DEFAULT_COMPRESSION; <add> let memLevel = Z_DEFAULT_MEMLEVEL; <add> let strategy = Z_DEFAULT_STRATEGY; <add> let dictionary; <ide> <ide> if (opts) { <ide> // windowBits is special. On the compression side, 0 is an invalid value. <ide> ObjectDefineProperties(module.exports, { <ide> // These should be considered deprecated <ide> // expose all the zlib constants <ide> const bkeys = ObjectKeys(constants); <del>for (var bk = 0; bk < bkeys.length; bk++) { <del> var bkey = bkeys[bk]; <add>for (let bk = 0; bk < bkeys.length; bk++) { <add> const bkey = bkeys[bk]; <ide> if (bkey.startsWith('BROTLI')) continue; <ide> ObjectDefineProperty(module.exports, bkey, { <ide> enumerable: false, value: constants[bkey], writable: false
1
Javascript
Javascript
apply camelcase in test-net-reconnect-error
4c6ef4b7e28afb31228ce29bf3a20f94b90554dc
<ide><path>test/sequential/test-net-reconnect-error.js <ide> const common = require('../common'); <ide> const net = require('net'); <ide> const assert = require('assert'); <ide> const N = 20; <del>let client_error_count = 0; <del>let disconnect_count = 0; <add>let clientErrorCount = 0; <add>let disconnectCount = 0; <ide> <ide> const c = net.createConnection(common.PORT); <ide> <ide> c.on('connect', common.mustNotCall('client should not have connected')); <ide> <ide> c.on('error', common.mustCall((e) => { <del> client_error_count++; <add> clientErrorCount++; <ide> assert.strictEqual(e.code, 'ECONNREFUSED'); <ide> }, N + 1)); <ide> <ide> c.on('close', common.mustCall(() => { <del> if (disconnect_count++ < N) <add> if (disconnectCount++ < N) <ide> c.connect(common.PORT); // reconnect <ide> }, N + 1)); <ide> <ide> process.on('exit', function() { <del> assert.strictEqual(disconnect_count, N + 1); <del> assert.strictEqual(client_error_count, N + 1); <add> assert.strictEqual(disconnectCount, N + 1); <add> assert.strictEqual(clientErrorCount, N + 1); <ide> });
1
Java
Java
reduce code duplication in contextloaderutils
33d5b011d3e6e85767e910896f5dacf5930eb08a
<ide><path>spring-test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java <ide> <ide> import java.util.ArrayList; <ide> import java.util.Arrays; <del>import java.util.Collections; <ide> import java.util.HashSet; <ide> import java.util.List; <ide> import java.util.Set; <ide> private ContextLoaderUtils() { <ide> } <ide> <ide> /** <del> * Resolve the {@link ContextLoader} {@link Class class} to use for the <del> * supplied {@link Class testClass} and then instantiate and return that <del> * {@code ContextLoader}. <add> * Resolve the {@link ContextLoader} {@linkplain Class class} to use for the <add> * supplied list of {@link ContextConfigurationAttributes} and then <add> * instantiate and return that {@code ContextLoader}. <ide> * <ide> * <p>If the supplied <code>defaultContextLoaderClassName</code> is <del> * <code>null</code> or <em>empty</em>, the <em>standard</em> <del> * default context loader class name {@value #DEFAULT_CONTEXT_LOADER_CLASS_NAME} <del> * will be used. For details on the class resolution process, see <del> * {@link #resolveContextLoaderClass()}. <add> * {@code null} or <em>empty</em>, depending on the absence or presence <add> * of @{@link WebAppConfiguration} either {@value #DEFAULT_CONTEXT_LOADER_CLASS_NAME} <add> * or {@value #DEFAULT_WEB_CONTEXT_LOADER_CLASS_NAME} will be used as the <add> * default context loader class name. For details on the class resolution <add> * process, see {@link #resolveContextLoaderClass()}. <ide> * <ide> * @param testClass the test class for which the {@code ContextLoader} <del> * should be resolved (must not be <code>null</code>) <add> * should be resolved; must not be {@code null} <add> * @param configAttributesList the list of configuration attributes to process; <add> * must not be {@code null} or <em>empty</em>; must be ordered <em>bottom-up</em> <add> * (i.e., as if we were traversing up the class hierarchy) <ide> * @param defaultContextLoaderClassName the name of the default <del> * {@code ContextLoader} class to use (may be <code>null</code>) <add> * {@code ContextLoader} class to use; may be {@code null} or <em>empty</em> <ide> * @return the resolved {@code ContextLoader} for the supplied <del> * <code>testClass</code> (never <code>null</code>) <add> * <code>testClass</code> (never {@code null}) <ide> * @see #resolveContextLoaderClass() <ide> */ <del> static ContextLoader resolveContextLoader(Class<?> testClass, String defaultContextLoaderClassName) { <del> Assert.notNull(testClass, "Test class must not be null"); <add> static ContextLoader resolveContextLoader(Class<?> testClass, <add> List<ContextConfigurationAttributes> configAttributesList, String defaultContextLoaderClassName) { <add> Assert.notNull(testClass, "Class must not be null"); <add> Assert.notEmpty(configAttributesList, "ContextConfigurationAttributes list must not be empty"); <ide> <ide> if (!StringUtils.hasText(defaultContextLoaderClassName)) { <ide> defaultContextLoaderClassName = testClass.isAnnotationPresent(WebAppConfiguration.class) ? DEFAULT_WEB_CONTEXT_LOADER_CLASS_NAME <ide> : DEFAULT_CONTEXT_LOADER_CLASS_NAME; <ide> } <ide> <del> Class<? extends ContextLoader> contextLoaderClass = resolveContextLoaderClass(testClass, <add> Class<? extends ContextLoader> contextLoaderClass = resolveContextLoaderClass(testClass, configAttributesList, <ide> defaultContextLoaderClassName); <ide> <ide> return instantiateClass(contextLoaderClass, ContextLoader.class); <ide> } <ide> <ide> /** <del> * Resolve the {@link ContextLoader} {@link Class} to use for the supplied <del> * {@link Class testClass}. <add> * Resolve the {@link ContextLoader} {@linkplain Class class} to use for the <add> * supplied list of {@link ContextConfigurationAttributes}. <add> * <add> * <p>Beginning with the first level in the context configuration attributes <add> * hierarchy: <ide> * <ide> * <ol> <del> * <li>If the {@link ContextConfiguration#loader() loader} attribute of <del> * {@link ContextConfiguration &#064;ContextConfiguration} is configured <del> * with an explicit class, that class will be returned.</li> <del> * <li>If a <code>loader</code> class is not specified, the class hierarchy <del> * will be traversed to find a parent class annotated with <del> * {@code @ContextConfiguration}; go to step #1.</li> <del> * <li>If no explicit <code>loader</code> class is found after traversing <del> * the class hierarchy, an attempt will be made to load and return the class <add> * <li>If the {@link ContextConfigurationAttributes#getContextLoaderClass() <add> * contextLoaderClass} property of {@link ContextConfigurationAttributes} is <add> * configured with an explicit class, that class will be returned.</li> <add> * <li>If an explicit {@code ContextLoader} class is not specified at the <add> * current level in the hierarchy, traverse to the next level in the hierarchy <add> * and return to step #1.</li> <add> * <li>If no explicit {@code ContextLoader} class is found after traversing <add> * the hierarchy, an attempt will be made to load and return the class <ide> * with the supplied <code>defaultContextLoaderClassName</code>.</li> <ide> * </ol> <ide> * <ide> * @param testClass the class for which to resolve the {@code ContextLoader} <del> * class; must not be <code>null</code> <add> * class; must not be {@code null}; only used for logging purposes <add> * @param configAttributesList the list of configuration attributes to process; <add> * must not be {@code null} or <em>empty</em>; must be ordered <em>bottom-up</em> <add> * (i.e., as if we were traversing up the class hierarchy) <ide> * @param defaultContextLoaderClassName the name of the default <del> * {@code ContextLoader} class to use; must not be <code>null</code> or empty <add> * {@code ContextLoader} class to use; must not be {@code null} or empty <ide> * @return the {@code ContextLoader} class to use for the supplied test class <ide> * @throws IllegalArgumentException if {@code @ContextConfiguration} is not <ide> * <em>present</em> on the supplied test class <ide> static ContextLoader resolveContextLoader(Class<?> testClass, String defaultCont <ide> */ <ide> @SuppressWarnings("unchecked") <ide> static Class<? extends ContextLoader> resolveContextLoaderClass(Class<?> testClass, <del> String defaultContextLoaderClassName) { <add> List<ContextConfigurationAttributes> configAttributesList, String defaultContextLoaderClassName) { <ide> Assert.notNull(testClass, "Class must not be null"); <add> Assert.notEmpty(configAttributesList, "ContextConfigurationAttributes list must not be empty"); <ide> Assert.hasText(defaultContextLoaderClassName, "Default ContextLoader class name must not be null or empty"); <ide> <del> Class<ContextConfiguration> annotationType = ContextConfiguration.class; <del> Class<?> declaringClass = findAnnotationDeclaringClass(annotationType, testClass); <del> Assert.notNull(declaringClass, String.format( <del> "Could not find an 'annotation declaring class' for annotation type [%s] and test class [%s]", <del> annotationType, testClass)); <del> <del> while (declaringClass != null) { <del> ContextConfiguration contextConfiguration = declaringClass.getAnnotation(annotationType); <del> <add> for (ContextConfigurationAttributes configAttributes : configAttributesList) { <ide> if (logger.isTraceEnabled()) { <del> logger.trace(String.format( <del> "Processing ContextLoader for @ContextConfiguration [%s] and declaring class [%s]", <del> contextConfiguration, declaringClass)); <add> logger.trace(String.format("Processing ContextLoader for context configuration attributes %s", <add> configAttributes)); <ide> } <ide> <del> Class<? extends ContextLoader> contextLoaderClass = contextConfiguration.loader(); <add> Class<? extends ContextLoader> contextLoaderClass = configAttributes.getContextLoaderClass(); <ide> if (!ContextLoader.class.equals(contextLoaderClass)) { <ide> if (logger.isDebugEnabled()) { <ide> logger.debug(String.format( <del> "Found explicit ContextLoader class [%s] for @ContextConfiguration [%s] and declaring class [%s]", <del> contextLoaderClass, contextConfiguration, declaringClass)); <add> "Found explicit ContextLoader class [%s] for context configuration attributes %s", <add> contextLoaderClass.getName(), configAttributes)); <ide> } <ide> return contextLoaderClass; <ide> } <del> <del> declaringClass = findAnnotationDeclaringClass(annotationType, declaringClass.getSuperclass()); <ide> } <ide> <ide> try { <ide> if (logger.isTraceEnabled()) { <ide> logger.trace(String.format("Using default ContextLoader class [%s] for test class [%s]", <del> defaultContextLoaderClassName, testClass)); <add> defaultContextLoaderClassName, testClass.getName())); <ide> } <ide> return (Class<? extends ContextLoader>) ContextLoaderUtils.class.getClassLoader().loadClass( <ide> defaultContextLoaderClassName); <del> } catch (ClassNotFoundException ex) { <add> } <add> catch (ClassNotFoundException ex) { <ide> throw new IllegalStateException("Could not load default ContextLoader class [" <ide> + defaultContextLoaderClassName + "]. Specify @ContextConfiguration's 'loader' " <ide> + "attribute or make the default loader class available."); <ide> static Class<? extends ContextLoader> resolveContextLoaderClass(Class<?> testCla <ide> * consideration. If these flags need to be honored, that must be handled <ide> * manually when traversing the list returned by this method. <ide> * <del> * @param clazz the class for which to resolve the configuration attributes (must <del> * not be <code>null</code>) <del> * @return the list of configuration attributes for the specified class <del> * (never <code>null</code>) <del> * @throws IllegalArgumentException if the supplied class is <code>null</code> or <add> * @param testClass the class for which to resolve the configuration attributes (must <add> * not be {@code null}) <add> * @return the list of configuration attributes for the specified class, ordered <em>bottom-up</em> <add> * (i.e., as if we were traversing up the class hierarchy); never {@code null} <add> * @throws IllegalArgumentException if the supplied class is {@code null} or <ide> * if {@code @ContextConfiguration} is not <em>present</em> on the supplied class <ide> */ <del> static List<ContextConfigurationAttributes> resolveContextConfigurationAttributes(Class<?> clazz) { <del> Assert.notNull(clazz, "Class must not be null"); <add> static List<ContextConfigurationAttributes> resolveContextConfigurationAttributes(Class<?> testClass) { <add> Assert.notNull(testClass, "Class must not be null"); <ide> <ide> final List<ContextConfigurationAttributes> attributesList = new ArrayList<ContextConfigurationAttributes>(); <ide> <ide> Class<ContextConfiguration> annotationType = ContextConfiguration.class; <del> Class<?> declaringClass = findAnnotationDeclaringClass(annotationType, clazz); <add> Class<?> declaringClass = findAnnotationDeclaringClass(annotationType, testClass); <ide> Assert.notNull(declaringClass, String.format( <del> "Could not find an 'annotation declaring class' for annotation type [%s] and class [%s]", annotationType, <del> clazz)); <add> "Could not find an 'annotation declaring class' for annotation type [%s] and class [%s]", <add> annotationType.getName(), testClass.getName())); <ide> <ide> while (declaringClass != null) { <ide> ContextConfiguration contextConfiguration = declaringClass.getAnnotation(annotationType); <del> <ide> if (logger.isTraceEnabled()) { <ide> logger.trace(String.format("Retrieved @ContextConfiguration [%s] for declaring class [%s].", <del> contextConfiguration, declaringClass)); <add> contextConfiguration, declaringClass.getName())); <ide> } <ide> <ide> ContextConfigurationAttributes attributes = new ContextConfigurationAttributes(declaringClass, <ide> static List<ContextConfigurationAttributes> resolveContextConfigurationAttribute <ide> logger.trace("Resolved context configuration attributes: " + attributes); <ide> } <ide> <del> attributesList.add(0, attributes); <add> attributesList.add(attributes); <ide> <ide> declaringClass = findAnnotationDeclaringClass(annotationType, declaringClass.getSuperclass()); <ide> } <ide> <ide> return attributesList; <ide> } <ide> <del> /** <del> * Create a copy of the supplied list of {@code ContextConfigurationAttributes} <del> * in reverse order. <del> * <del> * @since 3.2 <del> */ <del> private static List<ContextConfigurationAttributes> reverseContextConfigurationAttributes( <del> List<ContextConfigurationAttributes> configAttributesList) { <del> List<ContextConfigurationAttributes> configAttributesListReversed = new ArrayList<ContextConfigurationAttributes>( <del> configAttributesList); <del> Collections.reverse(configAttributesListReversed); <del> return configAttributesListReversed; <del> } <del> <ide> /** <ide> * Resolve the list of merged {@code ApplicationContextInitializer} classes <ide> * for the supplied list of {@code ContextConfigurationAttributes}. <ide> private static List<ContextConfigurationAttributes> reverseContextConfigurationA <ide> * at the given level will be merged with those defined in higher levels <ide> * of the class hierarchy. <ide> * <del> * @param configAttributesList the list of configuration attributes to process <del> * (must not be <code>null</code>) <del> * @return the list of merged context initializer classes, including those <del> * from superclasses if appropriate (never <code>null</code>) <add> * @param configAttributesList the list of configuration attributes to process; <add> * must not be {@code null} or <em>empty</em>; must be ordered <em>bottom-up</em> <add> * (i.e., as if we were traversing up the class hierarchy) <add> * @return the set of merged context initializer classes, including those <add> * from superclasses if appropriate (never {@code null}) <ide> * @since 3.2 <ide> */ <ide> static Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> resolveInitializerClasses( <ide> List<ContextConfigurationAttributes> configAttributesList) { <del> Assert.notNull(configAttributesList, "configAttributesList must not be null"); <add> Assert.notEmpty(configAttributesList, "ContextConfigurationAttributes list must not be empty"); <ide> <ide> final Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses = // <ide> new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>(); <ide> <del> // Traverse config attributes in reverse order (i.e., as if we were traversing up <del> // the class hierarchy). <del> for (ContextConfigurationAttributes configAttributes : reverseContextConfigurationAttributes(configAttributesList)) { <add> for (ContextConfigurationAttributes configAttributes : configAttributesList) { <ide> if (logger.isTraceEnabled()) { <ide> logger.trace(String.format("Processing context initializers for context configuration attributes %s", <ide> configAttributes)); <ide> static Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableA <ide> * set to <code>true</code>, profiles defined in the test class will be <ide> * merged with those defined in superclasses. <ide> * <del> * @param clazz the class for which to resolve the active profiles (must <del> * not be <code>null</code>) <add> * @param testClass the class for which to resolve the active profiles (must <add> * not be {@code null}) <ide> * @return the set of active profiles for the specified class, including <del> * active profiles from superclasses if appropriate (never <code>null</code>) <add> * active profiles from superclasses if appropriate (never {@code null}) <ide> * @see org.springframework.test.context.ActiveProfiles <ide> * @see org.springframework.context.annotation.Profile <ide> */ <del> static String[] resolveActiveProfiles(Class<?> clazz) { <del> Assert.notNull(clazz, "Class must not be null"); <add> static String[] resolveActiveProfiles(Class<?> testClass) { <add> Assert.notNull(testClass, "Class must not be null"); <ide> <ide> Class<ActiveProfiles> annotationType = ActiveProfiles.class; <del> Class<?> declaringClass = findAnnotationDeclaringClass(annotationType, clazz); <add> Class<?> declaringClass = findAnnotationDeclaringClass(annotationType, testClass); <ide> <ide> if (declaringClass == null && logger.isDebugEnabled()) { <ide> logger.debug(String.format( <ide> "Could not find an 'annotation declaring class' for annotation type [%s] and class [%s]", <del> annotationType, clazz)); <add> annotationType.getName(), testClass.getName())); <ide> } <ide> <ide> final Set<String> activeProfiles = new HashSet<String>(); <ide> static String[] resolveActiveProfiles(Class<?> clazz) { <ide> <ide> if (logger.isTraceEnabled()) { <ide> logger.trace(String.format("Retrieved @ActiveProfiles [%s] for declaring class [%s].", annotation, <del> declaringClass)); <add> declaringClass.getName())); <ide> } <ide> <ide> String[] profiles = annotation.profiles(); <ide> static String[] resolveActiveProfiles(Class<?> clazz) { <ide> if (!ObjectUtils.isEmpty(valueProfiles) && !ObjectUtils.isEmpty(profiles)) { <ide> String msg = String.format("Test class [%s] has been configured with @ActiveProfiles' 'value' [%s] " <ide> + "and 'profiles' [%s] attributes. Only one declaration of active bean " <del> + "definition profiles is permitted per @ActiveProfiles annotation.", declaringClass, <add> + "definition profiles is permitted per @ActiveProfiles annotation.", declaringClass.getName(), <ide> ObjectUtils.nullSafeToString(valueProfiles), ObjectUtils.nullSafeToString(profiles)); <ide> logger.error(msg); <ide> throw new IllegalStateException(msg); <del> } else if (!ObjectUtils.isEmpty(valueProfiles)) { <add> } <add> else if (!ObjectUtils.isEmpty(valueProfiles)) { <ide> profiles = valueProfiles; <ide> } <ide> <ide> static String[] resolveActiveProfiles(Class<?> clazz) { <ide> * <code>defaultContextLoaderClassName</code>. <ide> * <ide> * @param testClass the test class for which the {@code MergedContextConfiguration} <del> * should be built (must not be <code>null</code>) <add> * should be built (must not be {@code null}) <ide> * @param defaultContextLoaderClassName the name of the default <del> * {@code ContextLoader} class to use (may be <code>null</code>) <add> * {@code ContextLoader} class to use (may be {@code null}) <ide> * @return the merged context configuration <ide> * @see #resolveContextLoader() <ide> * @see #resolveContextConfigurationAttributes() <ide> static String[] resolveActiveProfiles(Class<?> clazz) { <ide> static MergedContextConfiguration buildMergedContextConfiguration(Class<?> testClass, <ide> String defaultContextLoaderClassName) { <ide> <del> final ContextLoader contextLoader = resolveContextLoader(testClass, defaultContextLoaderClassName); <ide> final List<ContextConfigurationAttributes> configAttributesList = resolveContextConfigurationAttributes(testClass); <add> final ContextLoader contextLoader = resolveContextLoader(testClass, configAttributesList, <add> defaultContextLoaderClassName); <ide> final List<String> locationsList = new ArrayList<String>(); <ide> final List<Class<?>> classesList = new ArrayList<Class<?>>(); <ide> <del> // Traverse config attributes in reverse order (i.e., as if we were traversing up <del> // the class hierarchy). <del> for (ContextConfigurationAttributes configAttributes : reverseContextConfigurationAttributes(configAttributesList)) { <add> for (ContextConfigurationAttributes configAttributes : configAttributesList) { <ide> if (logger.isTraceEnabled()) { <ide> logger.trace(String.format("Processing locations and classes for context configuration attributes %s", <ide> configAttributes)); <ide> static MergedContextConfiguration buildMergedContextConfiguration(Class<?> testC <ide> smartContextLoader.processContextConfiguration(configAttributes); <ide> locationsList.addAll(0, Arrays.asList(configAttributes.getLocations())); <ide> classesList.addAll(0, Arrays.asList(configAttributes.getClasses())); <del> } else { <add> } <add> else { <ide> String[] processedLocations = contextLoader.processLocations(configAttributes.getDeclaringClass(), <ide> configAttributes.getLocations()); <ide> locationsList.addAll(0, Arrays.asList(processedLocations)); <ide><path>spring-test/src/test/java/org/springframework/test/context/ContextLoaderUtilsTests.java <ide> <ide> package org.springframework.test.context; <ide> <del>import static org.springframework.test.context.ContextLoaderUtils.*; <ide> import static org.junit.Assert.*; <add>import static org.springframework.test.context.ContextLoaderUtils.*; <ide> <ide> import java.util.Arrays; <ide> import java.util.Collections; <ide> public void resolveConfigAttributesWithLocalAndInheritedAnnotationsAndLocations( <ide> List<ContextConfigurationAttributes> attributesList = resolveContextConfigurationAttributes(LocationsBar.class); <ide> assertNotNull(attributesList); <ide> assertEquals(2, attributesList.size()); <del> assertLocationsFooAttributes(attributesList.get(0)); <del> assertLocationsBarAttributes(attributesList.get(1)); <add> assertLocationsBarAttributes(attributesList.get(0)); <add> assertLocationsFooAttributes(attributesList.get(1)); <ide> } <ide> <ide> @Test <ide> public void resolveConfigAttributesWithLocalAndInheritedAnnotationsAndClasses() { <ide> List<ContextConfigurationAttributes> attributesList = resolveContextConfigurationAttributes(ClassesBar.class); <ide> assertNotNull(attributesList); <ide> assertEquals(2, attributesList.size()); <del> assertClassesFooAttributes(attributesList.get(0)); <del> assertClassesBarAttributes(attributesList.get(1)); <add> assertClassesBarAttributes(attributesList.get(0)); <add> assertClassesFooAttributes(attributesList.get(1)); <ide> } <ide> <ide> @Test(expected = IllegalArgumentException.class)
2
Javascript
Javascript
make easy changes as per code review
0e1edd910553c2c6f3e9624c4572ab5420aa9799
<ide><path>src/lib/duration/constructor.js <ide> import { getLocale } from '../locale/locales'; <ide> import isDurationValid from './valid.js'; <ide> <ide> export function Duration (duration) { <del> var normalizedInput = normalizeObjectUnits(duration); <add> var normalizedInput = normalizeObjectUnits(duration), <add> years = normalizedInput.year || 0, <add> quarters = normalizedInput.quarter || 0, <add> months = normalizedInput.month || 0, <add> weeks = normalizedInput.week || 0, <add> days = normalizedInput.day || 0, <add> hours = normalizedInput.hour || 0, <add> minutes = normalizedInput.minute || 0, <add> seconds = normalizedInput.second || 0, <add> milliseconds = normalizedInput.millisecond || 0; <ide> <ide> this._isValid = isDurationValid(normalizedInput); <ide> this.isValid = function () { <ide> return this._isValid; <ide> }; <ide> <del> var years = this._isValid && normalizedInput.year || 0, <del> quarters = this._isValid && normalizedInput.quarter || 0, <del> months = this._isValid && normalizedInput.month || 0, <del> weeks = this._isValid && normalizedInput.week || 0, <del> days = this._isValid && normalizedInput.day || 0, <del> hours = this._isValid && normalizedInput.hour || 0, <del> minutes = this._isValid && normalizedInput.minute || 0, <del> seconds = this._isValid && normalizedInput.second || 0, <del> milliseconds = this._isValid && normalizedInput.millisecond || 0; <del> <ide> // representation for dateAddRemove <ide> this._milliseconds = +milliseconds + <ide> seconds * 1e3 + // 1000 <ide><path>src/lib/duration/iso-string.js <ide> export function toISOString() { <ide> (m ? m + 'M' : '') + <ide> (s ? s + 'S' : ''); <ide> } <del> <del>export function toJSON() { <del> // this may not be fully implemented <del> return this.isValid() ? this.toISOString() : null; <del>} <ide><path>src/lib/duration/prototype.js <ide> import { as, asMilliseconds, asSeconds, asMinutes, asHours, asDays, asWeeks, asM <ide> import { bubble } from './bubble'; <ide> import { get, milliseconds, seconds, minutes, hours, days, months, years, weeks } from './get'; <ide> import { humanize } from './humanize'; <del>import { toISOString, toJSON } from './iso-string'; <add>import { toISOString } from './iso-string'; <ide> import { lang, locale, localeData } from '../moment/locale'; <add>import isDurationValid from './valid'; <ide> <ide> proto.abs = abs; <ide> proto.add = add; <ide> proto.years = years; <ide> proto.humanize = humanize; <ide> proto.toISOString = toISOString; <ide> proto.toString = toISOString; <del>proto.toJSON = toJSON; <add>proto.toJSON = toISOString; <ide> proto.locale = locale; <ide> proto.localeData = localeData; <add>proto.isValid = isDurationValid; <ide> <ide> // Deprecations <ide> import { deprecate } from '../utils/deprecate'; <ide><path>src/lib/duration/valid.js <add>import toInt from '../utils/to-int'; <add> <ide> var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond']; <ide> <ide> export default function isDurationValid(m) { <ide> for (var key in m) { <del> if (ordering.indexOf(key) === -1 || <del> m[key] !== undefined && isNaN(parseInt(m[key]))) { <add> if (!(ordering.indexOf(key) !== -1 && (m[key] == null || !isNaN(m[key])))) { <ide> return false; <ide> } <ide> } <ide> export default function isDurationValid(m) { <ide> if (unitHasDecimal) { <ide> return false; // only allow non-integers for smallest unit <ide> } <del> if (parseFloat(m[ordering[i]]) !== parseInt(m[ordering[i]])) { <add> if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { <ide> unitHasDecimal = true; <ide> } <ide> } <ide><path>src/test/moment/duration_invalid.js <ide> test('invalid duration operations', function (assert) { <ide> for (i = 0; i < invalids.length; ++i) { <ide> invalid = invalids[i]; <ide> <del> assert.ok(!invalid.add(5, 'hours').isValid(), 'invalid.add is invalid'); <del> assert.ok(!invalid.subtract(30, 'days').isValid(), 'invalid.subtract is invalid'); <del> assert.ok(!invalid.abs().isValid(), 'invalid.abs is invalid'); <del> assert.ok(isNaN(invalid.as('years')), 'invalid.as is NaN'); <del> assert.ok(isNaN(invalid.asMilliseconds()), 'invalid.asMilliseconds is NaN'); <del> assert.ok(isNaN(invalid.asSeconds()), 'invalid.asSeconds is NaN'); <del> assert.ok(isNaN(invalid.asMinutes()), 'invalid.asMinutes is NaN'); <del> assert.ok(isNaN(invalid.asHours()), 'invalid.asHours is NaN'); <del> assert.ok(isNaN(invalid.asDays()), 'invalid.asDays is NaN'); <del> assert.ok(isNaN(invalid.asWeeks()), 'invalid.asWeeks is NaN'); <del> assert.ok(isNaN(invalid.asMonths()), 'invalid.asMonths is NaN'); <del> assert.ok(isNaN(invalid.asYears()), 'invalid.asYears is NaN'); <del> assert.ok(isNaN(invalid.valueOf()), 'invalid.valueOf is NaN'); <del> assert.ok(isNaN(invalid.get('hours')), 'invalid.get is NaN'); <add> assert.ok(!invalid.add(5, 'hours').isValid(), 'invalid.add is invalid; i=' + i); <add> assert.ok(!invalid.subtract(30, 'days').isValid(), 'invalid.subtract is invalid; i=' + i); <add> assert.ok(!invalid.abs().isValid(), 'invalid.abs is invalid; i=' + i); <add> assert.ok(isNaN(invalid.as('years')), 'invalid.as is NaN; i=' + i); <add> assert.ok(isNaN(invalid.asMilliseconds()), 'invalid.asMilliseconds is NaN; i=' + i); <add> assert.ok(isNaN(invalid.asSeconds()), 'invalid.asSeconds is NaN; i=' + i); <add> assert.ok(isNaN(invalid.asMinutes()), 'invalid.asMinutes is NaN; i=' + i); <add> assert.ok(isNaN(invalid.asHours()), 'invalid.asHours is NaN; i=' + i); <add> assert.ok(isNaN(invalid.asDays()), 'invalid.asDays is NaN; i=' + i); <add> assert.ok(isNaN(invalid.asWeeks()), 'invalid.asWeeks is NaN; i=' + i); <add> assert.ok(isNaN(invalid.asMonths()), 'invalid.asMonths is NaN; i=' + i); <add> assert.ok(isNaN(invalid.asYears()), 'invalid.asYears is NaN; i=' + i); <add> assert.ok(isNaN(invalid.valueOf()), 'invalid.valueOf is NaN; i=' + i); <add> assert.ok(isNaN(invalid.get('hours')), 'invalid.get is NaN; i=' + i); <ide> <del> assert.ok(isNaN(invalid.milliseconds()), 'invalid.milliseconds is NaN'); <del> assert.ok(isNaN(invalid.seconds()), 'invalid.seconds is NaN'); <del> assert.ok(isNaN(invalid.minutes()), 'invalid.minutes is NaN'); <del> assert.ok(isNaN(invalid.hours()), 'invalid.hours is NaN'); <del> assert.ok(isNaN(invalid.days()), 'invalid.days is NaN'); <del> assert.ok(isNaN(invalid.weeks()), 'invalid.weeks is NaN'); <del> assert.ok(isNaN(invalid.months()), 'invalid.months is NaN'); <del> assert.ok(isNaN(invalid.years()), 'invalid.years is NaN'); <add> assert.ok(isNaN(invalid.milliseconds()), 'invalid.milliseconds is NaN; i=' + i); <add> assert.ok(isNaN(invalid.seconds()), 'invalid.seconds is NaN; i=' + i); <add> assert.ok(isNaN(invalid.minutes()), 'invalid.minutes is NaN; i=' + i); <add> assert.ok(isNaN(invalid.hours()), 'invalid.hours is NaN; i=' + i); <add> assert.ok(isNaN(invalid.days()), 'invalid.days is NaN; i=' + i); <add> assert.ok(isNaN(invalid.weeks()), 'invalid.weeks is NaN; i=' + i); <add> assert.ok(isNaN(invalid.months()), 'invalid.months is NaN; i=' + i); <add> assert.ok(isNaN(invalid.years()), 'invalid.years is NaN; i=' + i); <ide> <ide> assert.equal(invalid.humanize(), <ide> invalid.localeData().invalidDate(), <del> 'invalid.humanize is localized invalid duration string'); <add> 'invalid.humanize is localized invalid duration string; i=' + i); <ide> assert.equal(invalid.toISOString(), <ide> invalid.localeData().invalidDate(), <del> 'invalid.toISOString is localized invalid duration string'); <add> 'invalid.toISOString is localized invalid duration string; i=' + i); <ide> assert.equal(invalid.toString(), <ide> invalid.localeData().invalidDate(), <del> 'invalid.toString is localized invalid duration string'); <del> assert.equal(invalid.toJSON(), null, 'invalid.toJSON is null'); <del> assert.equal(invalid.locale(), 'en'); <del> assert.equal(invalid.localeData()._abbr, 'en'); <add> 'invalid.toString is localized invalid duration string; i=' + i); <add> assert.equal(invalid.toJSON(), invalid.localeData().invalidDate(), 'invalid.toJSON is null; i=' + i); <add> assert.equal(invalid.locale(), 'en', 'invalid.locale; i=' + i); <add> assert.equal(invalid.localeData()._abbr, 'en', 'invalid.localeData()._abbr; i=' + i); <ide> } <ide> });
5
Javascript
Javascript
fix top level detection in the parser
a8b32acad59407e2c707401c9af850d1b7fc009b
<ide><path>lib/Parser.js <ide> class Parser extends Tapable { <ide> } <ide> <ide> walkFunctionDeclaration(statement) { <add> const wasTopLevel = this.scope.topLevelScope; <add> this.scope.topLevelScope = false; <ide> for (const param of statement.params) this.walkPattern(param); <ide> this.inScope(statement.params, () => { <del> this.scope.topLevelScope = false; <ide> if (statement.body.type === "BlockStatement") { <ide> this.detectStrictMode(statement.body.body); <ide> this.prewalkStatement(statement.body); <ide> class Parser extends Tapable { <ide> this.walkExpression(statement.body); <ide> } <ide> }); <add> this.scope.topLevelScope = wasTopLevel; <ide> } <ide> <ide> prewalkImportDeclaration(statement) { <ide> class Parser extends Tapable { <ide> } <ide> <ide> walkFunctionExpression(expression) { <add> const wasTopLevel = this.scope.topLevelScope; <add> this.scope.topLevelScope = false; <ide> for (const param of expression.params) this.walkPattern(param); <ide> this.inScope(expression.params, () => { <del> this.scope.topLevelScope = false; <ide> if (expression.body.type === "BlockStatement") { <ide> this.detectStrictMode(expression.body.body); <ide> this.prewalkStatement(expression.body); <ide> class Parser extends Tapable { <ide> this.walkExpression(expression.body); <ide> } <ide> }); <add> this.scope.topLevelScope = wasTopLevel; <ide> } <ide> <ide> walkArrowFunctionExpression(expression) { <ide> class Parser extends Tapable { <ide> } <ide> this.walkExpression(argOrThis); <ide> }; <add> const wasTopLevel = this.scope.topLevelScope; <add> this.scope.topLevelScope = false; <ide> const params = functionExpression.params; <del> const renameThis = currentThis <del> ? renameArgOrThis.call(this, currentThis) <del> : null; <add> const renameThis = currentThis ? renameArgOrThis(currentThis) : null; <ide> const args = options.map(renameArgOrThis); <ide> this.inScope(params.filter((identifier, idx) => !args[idx]), () => { <ide> if (renameThis) { <ide> class Parser extends Tapable { <ide> this.walkStatement(functionExpression.body); <ide> } else this.walkExpression(functionExpression.body); <ide> }); <add> this.scope.topLevelScope = wasTopLevel; <ide> }; <ide> if ( <ide> expression.callee.type === "MemberExpression" && <ide> class Parser extends Tapable { <ide> expression.arguments.length > 0 <ide> ) { <ide> // (function(…) { }.call/bind(?, …)) <del> walkIIFE.call( <del> this, <add> walkIIFE( <ide> expression.callee.object, <ide> expression.arguments.slice(1), <ide> expression.arguments[0] <ide> class Parser extends Tapable { <ide> expression.arguments <ide> ) { <ide> // (function(…) { }(…)) <del> walkIIFE.call(this, expression.callee, expression.arguments); <add> walkIIFE(expression.callee, expression.arguments, null); <ide> } else if (expression.callee.type === "Import") { <ide> result = this.hooks.importCall.call(expression); <ide> if (result === true) return;
1
Text
Text
fix broken link
05f61b22adb4d7d636bbaad531cb6eb2ff5fc391
<ide><path>examples/ssr-caching/README.md <ide> React Server Side rendering is very costly and takes a lot of server's CPU power for that. One of the best solutions for this problem is cache already rendered pages. <ide> That's what this example demonstrate. <ide> <del>This app uses Next's [custom server and routing](https://github.com/vercel/next.js#custom-server-and-routing) mode. It also uses [express](https://expressjs.com/) to handle routing and page serving. <add>This app uses Next's [custom server and routing](https://nextjs.org/docs/advanced-features/custom-server) mode. It also uses [express](https://expressjs.com/) to handle routing and page serving. <ide> <ide> ## How to use <ide>
1
Python
Python
set version to v2.0.14
41adf3572b30813d7e6fe8e07e29824ce9f87979
<ide><path>spacy/about.py <ide> # https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py <ide> <ide> __title__ = 'spacy' <del>__version__ = '2.0.14.dev0' <add>__version__ = '2.0.14' <ide> __summary__ = 'Industrial-strength Natural Language Processing (NLP) with Python and Cython' <ide> __uri__ = 'https://spacy.io' <ide> __author__ = 'Explosion AI'
1
Java
Java
update copyright year of changed file
c204cc7ba0a2a62994b7275ad0743624c1344597
<ide><path>spring-context/src/main/java/org/springframework/cache/annotation/EnableCaching.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2021 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License.
1
Ruby
Ruby
build quoted strings
d38352ef9e63ec6e1ffee3e4fe78101df36bd6d8
<ide><path>lib/arel/factory_methods.rb <ide> def grouping expr <ide> ### <ide> # Create a LOWER() function <ide> def lower column <del> Nodes::NamedFunction.new 'LOWER', [column] <add> Nodes::NamedFunction.new 'LOWER', [Nodes.build_quoted(column)] <ide> end <ide> end <ide> end <ide><path>lib/arel/predications.rb <ide> def in other <ide> if other.begin == -Float::INFINITY && other.end == Float::INFINITY <ide> Nodes::NotIn.new self, [] <ide> elsif other.end == Float::INFINITY <del> Nodes::GreaterThanOrEqual.new(self, other.begin) <add> Nodes::GreaterThanOrEqual.new(self, Nodes.build_quoted(other.begin, self)) <ide> elsif other.begin == -Float::INFINITY && other.exclude_end? <del> Nodes::LessThan.new(self, other.end) <add> Nodes::LessThan.new(self, Nodes.build_quoted(other.end, self)) <ide> elsif other.begin == -Float::INFINITY <del> Nodes::LessThanOrEqual.new(self, other.end) <add> Nodes::LessThanOrEqual.new(self, Nodes.build_quoted(other.end, self)) <ide> elsif other.exclude_end? <del> left = Nodes::GreaterThanOrEqual.new(self, other.begin) <del> right = Nodes::LessThan.new(self, other.end) <add> left = Nodes::GreaterThanOrEqual.new(self, Nodes.build_quoted(other.begin, self)) <add> right = Nodes::LessThan.new(self, Nodes.build_quoted(other.end, self)) <ide> Nodes::And.new [left, right] <ide> else <del> Nodes::Between.new(self, Nodes::And.new([other.begin, other.end])) <add> Nodes::Between.new(self, Nodes::And.new([Nodes.build_quoted(other.begin, self), Nodes.build_quoted(other.end, self)])) <ide> end <ide> else <del> Nodes::In.new self, other <add> Nodes::In.new self, other.map { |x| Nodes.build_quoted(x, self) } <ide> end <ide> end <ide> <ide><path>lib/arel/select_manager.rb <ide> def with *subqueries <ide> <ide> def take limit <ide> if limit <del> @ast.limit = Nodes::Limit.new(limit) <del> @ctx.top = Nodes::Top.new(limit) <add> @ast.limit = Nodes::Limit.new(Nodes.build_quoted(limit)) <add> @ctx.top = Nodes::Top.new(Nodes.build_quoted(limit)) <ide> else <ide> @ast.limit = nil <ide> @ctx.top = nil
3
Go
Go
remove use of docker/docker/errdefs in tests
570c5f9e764339effe6be9d57ea0aa3e81147695
<ide><path>libnetwork/libnetwork_test.go <ide> import ( <ide> "sync" <ide> "testing" <ide> <del> "github.com/docker/docker/errdefs" <ide> "github.com/docker/docker/pkg/plugins" <ide> "github.com/docker/docker/pkg/reexec" <ide> "github.com/docker/libnetwork" <ide> func getPortMapping() []types.PortBinding { <ide> } <ide> } <ide> <add>func isNotFound(err error) bool { <add> _, ok := (err).(types.NotFoundError) <add> return ok <add>} <add> <ide> func TestNull(t *testing.T) { <ide> cnt, err := controller.NewSandbox("null_container", <ide> libnetwork.OptionHostname("test"), <ide> func TestUnknownDriver(t *testing.T) { <ide> t.Fatal("Expected to fail. But instead succeeded") <ide> } <ide> <del> if !errdefs.IsNotFound(err) { <add> if !isNotFound(err) { <ide> t.Fatalf("Did not fail with expected error. Actual error: %v", err) <ide> } <ide> } <ide> func TestNilRemoteDriver(t *testing.T) { <ide> t.Fatal("Expected to fail. But instead succeeded") <ide> } <ide> <del> if !errdefs.IsNotFound(err) { <add> if !isNotFound(err) { <ide> t.Fatalf("Did not fail with expected error. Actual error: %v", err) <ide> } <ide> } <ide> func TestValidRemoteDriver(t *testing.T) { <ide> libnetwork.NetworkOptionGeneric(getEmptyGenericOption())) <ide> if err != nil { <ide> // Only fail if we could not find the plugin driver <del> if errdefs.IsNotFound(err) { <add> if isNotFound(err) { <ide> t.Fatal(err) <ide> } <ide> return
1
Javascript
Javascript
add tests for harmony with devtools
ba7b3aabbfc5399f89652a2d3ea106219e39b4cc
<ide><path>test/configCases/devtools/harmony-eval-source-map/index.js <add>export {} <add>it("should run fine", function() {}); <ide><path>test/configCases/devtools/harmony-eval-source-map/webpack.config.js <add>module.exports = { <add> devtool: "eval-source-map" <add>}; <ide><path>test/configCases/devtools/harmony-eval/index.js <add>export {} <add>it("should run fine", function() {}); <ide><path>test/configCases/devtools/harmony-eval/webpack.config.js <add>module.exports = { <add> devtool: "eval" <add>};
4
Python
Python
prefer filter to remove empty strings
1d152b6e51c97f8527d1a675084f8bc15444d7f4
<ide><path>tools/test.py <ide> def ProcessOptions(options): <ide> options.arch = options.arch.split(',') <ide> options.mode = options.mode.split(',') <ide> options.run = options.run.split(',') <del> options.skip_tests = options.skip_tests.split(',') <del> options.skip_tests.remove("") <add> # Split at commas and filter out all the empty strings. <add> options.skip_tests = filter(bool, options.skip_tests.split(',')) <ide> if options.run == [""]: <ide> options.run = None <ide> elif len(options.run) != 2:
1
Javascript
Javascript
add example on how to use the element.injector
b4d44e12987131bfd23399947fe9b2f860cc5729
<ide><path>src/auto/injector.js <ide> * $rootScope.$digest(); <ide> * }); <ide> * </pre> <add> * <add> * Sometimes you want to get access to the injector of a currently running Angular app <add> * from outside Angular. Perhaps, you want to inject and compile some markup after the <add> * application has been bootstrapped. You can do this using extra `injector()` added <add> * to JQuery/jqLite elements. See {@link angular.element}. <add> * <add> * *This is fairly rare but could be the case if a third party library is injecting the <add> * markup.* <add> * <add> * In the following example a new block of HTML containing a `ng-controller` <add> * directive is added to the end of the document body by JQuery. We then compile and link <add> * it into the current AngularJS scope. <add> * <add> * <pre> <add> * var $div = $('<div ng-controller="MyCtrl">{{content.label}}</div>'); <add> * $(document.body).append($div); <add> * <add> * angular.element(document).injector().invoke(function($compile) { <add> * var scope = angular.element($div).scope(); <add> * $compile($div)(scope); <add> * }); <add> * </pre> <ide> */ <ide> <ide>
1
Text
Text
remove extra space
d9262a84156c104f97f110ccc0e78d45a031d7fd
<ide><path>docs/publishing-a-package.md <ide> This guide will show you how to publish a package or theme to the <ide> [atom.io][atomio] package registry. <ide> <del>Publishing a package allows other people to install it and use it in Atom. It <add>Publishing a package allows other people to install it and use it in Atom. It <ide> is a great way to share what you've made and get feedback and contributions from <ide> others. <ide>
1
Javascript
Javascript
remove duplicate comment
1c84914c5a3bfc71969ca1930818d43192ae3ae8
<ide><path>lib/_http_common.js <ide> const parsers = new FreeList('parsers', 1000, function() { <ide> parser.incoming = null; <ide> parser.outgoing = null; <ide> <del> // Only called in the slow case where slow means <del> // that the request headers were either fragmented <del> // across multiple TCP packets or too large to be <del> // processed in a single run. This method is also <del> // called to process trailing HTTP headers. <ide> parser[kOnHeaders] = parserOnHeaders; <ide> parser[kOnHeadersComplete] = parserOnHeadersComplete; <ide> parser[kOnBody] = parserOnBody;
1
Javascript
Javascript
use countdown in http-agent test
f373a1d8145785b03aa535c739984d832fa0000a
<ide><path>test/parallel/test-http-agent.js <ide> <ide> 'use strict'; <ide> const common = require('../common'); <add>const Countdown = require('../common/countdown'); <ide> const assert = require('assert'); <ide> const http = require('http'); <ide> common.crashOnUnhandledRejection(); <ide> const server = http.Server(common.mustCall(function(req, res) { <ide> }, (N * M))); // N * M = good requests (the errors will not be counted) <ide> <ide> function makeRequests(outCount, inCount, shouldFail) { <del> let responseCount = outCount * inCount; <add> const countdown = new Countdown( <add> outCount * inCount, <add> common.mustCall(() => server.close()) <add> ); <ide> let onRequest = common.mustNotCall(); // Temporary <ide> const p = new Promise((resolve) => { <ide> onRequest = common.mustCall((res) => { <del> if (--responseCount === 0) { <del> server.close(); <add> if (countdown.dec() === 0) { <ide> resolve(); <ide> } <add> <ide> if (!shouldFail) <ide> res.resume(); <ide> }, outCount * inCount);
1
Javascript
Javascript
add a pointermove with animatedevent example
89f090016d8aa5366b8498d7a0227f8ad0e413d6
<ide><path>packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityAnimatedPointerMove.js <add>/** <add> * Copyright (c) Meta Platforms, Inc. and affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @format <add> * @flow <add> */ <add> <add>import * as React from 'react'; <add>import {Text, Animated, StyleSheet} from 'react-native'; <add>import type {RNTesterModuleExample} from '../../../types/RNTesterTypes'; <add>import ToggleNativeDriver from '../../Animated/utils/ToggleNativeDriver'; <add> <add>const WIDTH = 200; <add>const HEIGHT = 250; <add> <add>const styles = StyleSheet.create({ <add> container: { <add> backgroundColor: 'black', <add> marginTop: 20, <add> width: WIDTH, <add> height: HEIGHT, <add> alignSelf: 'center', <add> }, <add> text: { <add> color: 'white', <add> position: 'absolute', <add> top: HEIGHT / 2, <add> }, <add> animatingBox: { <add> backgroundColor: 'blue', <add> width: 1, <add> height: 1, <add> }, <add>}); <add> <add>function CompatibilityAnimatedPointerMove(): React.Node { <add> const xCoord = React.useRef(new Animated.Value(0)).current; <add> const yCoord = React.useRef(new Animated.Value(0)).current; <add> const [useNativeDriver, setUseNativeDriver] = React.useState(true); <add> <add> return ( <add> <> <add> <ToggleNativeDriver <add> style={{paddingHorizontal: 30}} <add> value={useNativeDriver} <add> onValueChange={setUseNativeDriver} <add> /> <add> <Animated.View <add> onPointerMove={Animated.event( <add> [{nativeEvent: {offsetX: xCoord, offsetY: yCoord}}], <add> {useNativeDriver}, <add> )} <add> pointerEvents="box-only" <add> style={styles.container}> <add> <Text style={styles.text}>Move pointer over me</Text> <add> <Animated.View <add> style={{ <add> backgroundColor: 'blue', <add> width: 1, <add> height: 1, <add> transform: [ <add> { <add> translateX: xCoord.interpolate({ <add> inputRange: [0, WIDTH], <add> outputRange: ([0, WIDTH / 2]: number[]), <add> }), <add> }, <add> { <add> translateY: yCoord.interpolate({ <add> inputRange: [0, HEIGHT], <add> outputRange: ([0, HEIGHT / 2]: number[]), <add> }), <add> }, <add> { <add> scaleX: xCoord.interpolate({ <add> inputRange: [0, WIDTH], <add> outputRange: ([0, WIDTH]: number[]), <add> }), <add> }, <add> { <add> scaleY: yCoord.interpolate({ <add> inputRange: [0, HEIGHT], <add> outputRange: ([0, HEIGHT]: number[]), <add> }), <add> }, <add> ], <add> }} <add> /> <add> </Animated.View> <add> </> <add> ); <add>} <add> <add>export default ({ <add> name: 'compatibility_animatedevent_pointer_move', <add> description: <add> 'An AnimatedEvent example on onPointerMove. The blue box should scale to pointer event offset values within black box', <add> title: 'AnimatedEvent with pointermove', <add> render(): React.Node { <add> return <CompatibilityAnimatedPointerMove />; <add> }, <add>}: RNTesterModuleExample); <ide><path>packages/rn-tester/js/examples/Experimental/W3CPointerEventsExample.js <ide> import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTyp <ide> <ide> import PointerEventAttributesHoverablePointers from './W3CPointerEventPlatformTests/PointerEventAttributesHoverablePointers'; <ide> import PointerEventPointerMove from './W3CPointerEventPlatformTests/PointerEventPointerMove'; <add>import CompatibilityAnimatedPointerMove from './Compatibility/CompatibilityAnimatedPointerMove'; <ide> <ide> function EventfulView(props: {| <ide> name: string, <ide> export default { <ide> return <PointerEventPointerMove />; <ide> }, <ide> }, <add> CompatibilityAnimatedPointerMove, <ide> ], <ide> };
2
Mixed
Javascript
update json header parsing for backticks
be46a7257b36ce5519d56e50db12f91b82d194f4
<ide><path>test/doctool/test-doctool-json.js <ide> const testData = [ <ide> } <ide> ] <ide> } <add> }, <add> { <add> file: fixtures.path('doc_with_backticks_in_headings.md'), <add> json: { <add> type: 'module', <add> source: 'foo', <add> modules: [ <add> { <add> textRaw: 'Fhqwhgads', <add> name: 'fhqwhgads', <add> properties: [ <add> { <add> name: 'fullName', <add> textRaw: '`Fqhqwhgads.fullName`' <add> } <add> ], <add> classMethods: [ <add> { <add> name: 'again', <add> signatures: [ <add> { <add> params: [] <add> } <add> ], <add> textRaw: 'Class Method: `Fhqwhgads.again()`', <add> type: 'classMethod' <add> } <add> ], <add> classes: [ <add> { <add> textRaw: 'Class: `ComeOn`', <add> type: 'class', <add> name: 'ComeOn' <add> } <add> ], <add> ctors: [ <add> { <add> name: 'Fhqwhgads', <add> signatures: [ <add> { <add> params: [] <add> } <add> ], <add> textRaw: 'Constructor: `new Fhqwhgads()`', <add> type: 'ctor' <add> } <add> ], <add> methods: [ <add> { <add> textRaw: '`everybody.to(limit)`', <add> type: 'method', <add> name: 'to', <add> signatures: [{ params: [] }] <add> } <add> ], <add> events: [ <add> { <add> textRaw: "Event: `'FHQWHfest'`", <add> type: 'event', <add> name: 'FHQWHfest', <add> params: [] <add> } <add> ], <add> type: 'module', <add> displayName: 'Fhqwhgads' <add> } <add> ] <add> } <ide> } <ide> ]; <ide> <ide><path>test/fixtures/doc_with_backticks_in_headings.md <add># Fhqwhgads <add> <add>## Class: `ComeOn` <add> <add>## `everybody.to(limit)` <add> <add>## Event: `'FHQWHfest'` <add> <add>## Constructor: `new Fhqwhgads()` <add> <add>## Class Method: `Fhqwhgads.again()` <add> <add>## `Fqhqwhgads.fullName` <ide><path>tools/doc/json.js <ide> const r = String.raw; <ide> <ide> const eventPrefix = '^Event: +'; <ide> const classPrefix = '^[Cc]lass: +'; <del>const ctorPrefix = '^(?:[Cc]onstructor: +)?new +'; <add>const ctorPrefix = '^(?:[Cc]onstructor: +)?`?new +'; <ide> const classMethodPrefix = '^Class Method: +'; <ide> const maybeClassPropertyPrefix = '(?:Class Property: +)?'; <ide> <ide> const maybeQuote = '[\'"]?'; <ide> const notQuotes = '[^\'"]+'; <ide> <add>const maybeBacktick = '`?'; <add> <ide> // To include constructs like `readable\[Symbol.asyncIterator\]()` <ide> // or `readable.\_read(size)` (with Markdown escapes). <ide> const simpleId = r`(?:(?:\\?_)+|\b)\w+\b`; <ide> const noCallOrProp = '(?![.[(])'; <ide> <ide> const maybeExtends = `(?: +extends +${maybeAncestors}${classId})?`; <ide> <add>/* eslint-disable max-len */ <ide> const headingExpressions = [ <ide> { type: 'event', re: RegExp( <del> `${eventPrefix}${maybeQuote}(${notQuotes})${maybeQuote}$`, 'i') }, <add> `${eventPrefix}${maybeBacktick}${maybeQuote}(${notQuotes})${maybeQuote}${maybeBacktick}$`, 'i') }, <ide> <ide> { type: 'class', re: RegExp( <del> `${classPrefix}(${maybeAncestors}${classId})${maybeExtends}$`, '') }, <add> `${classPrefix}${maybeBacktick}(${maybeAncestors}${classId})${maybeExtends}${maybeBacktick}$`, '') }, <ide> <ide> { type: 'ctor', re: RegExp( <del> `${ctorPrefix}(${maybeAncestors}${classId})${callWithParams}$`, '') }, <add> `${ctorPrefix}(${maybeAncestors}${classId})${callWithParams}${maybeBacktick}$`, '') }, <ide> <ide> { type: 'classMethod', re: RegExp( <del> `${classMethodPrefix}${maybeAncestors}(${id})${callWithParams}$`, 'i') }, <add> `${classMethodPrefix}${maybeBacktick}${maybeAncestors}(${id})${callWithParams}${maybeBacktick}$`, 'i') }, <ide> <ide> { type: 'method', re: RegExp( <del> `^${maybeAncestors}(${id})${callWithParams}$`, 'i') }, <add> `^${maybeBacktick}${maybeAncestors}(${id})${callWithParams}${maybeBacktick}$`, 'i') }, <ide> <ide> { type: 'property', re: RegExp( <del> `^${maybeClassPropertyPrefix}${ancestors}(${id})${noCallOrProp}$`, 'i') }, <add> `^${maybeClassPropertyPrefix}${maybeBacktick}${ancestors}(${id})${maybeBacktick}${noCallOrProp}$`, 'i') }, <ide> ]; <add>/* eslint-enable max-len */ <ide> <ide> function newSection(header, file) { <ide> const text = textJoin(header.children, file);
3
Javascript
Javascript
use a constant for the default y0
886c4db94dc99425f96431e37fbf9f889687bfe3
<ide><path>d3.js <ide> function d3_svg_lineMonotone(points) { <ide> } <ide> d3.svg.area = function() { <ide> var x = d3_svg_lineX, <del> y0 = d3_svg_areaY0, <add> y0 = 0, <ide> y1 = d3_svg_lineY, <ide> interpolate = "linear", <ide> interpolator = d3_svg_lineInterpolators[interpolate], <ide> d3.svg.area = function() { <ide> <ide> return area; <ide> }; <del> <del>function d3_svg_areaY0() { <del> return 0; <del>} <ide> d3.svg.chord = function() { <ide> var source = d3_svg_chordSource, <ide> target = d3_svg_chordTarget, <ide><path>d3.min.js <del>(function(){function ch(){return"circle"}function cg(){return 64}function cf(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(ce<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();ce=!e.f&&!e.e,d.remove()}ce?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function cd(a){return[a.x,a.y]}function cc(a){return a.endAngle}function cb(a){return a.startAngle}function ca(a){return a.radius}function b_(a){return a.target}function b$(a){return a.source}function bZ(){return 0}function bY(a){return a.length<3?bF(a):a[0]+bL(a,bX(a))}function bX(a){var b=[],c,d,e,f,g=bW(a),h=-1,i=a.length-1;while(++h<i)c=bV(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function bW(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=bV(e,f);while(++b<c)d[b]=g+(g=bV(e=f,f=a[b+1]));d[b]=g;return d}function bV(a,b){return(b[1]-a[1])/(b[0]-a[0])}function bU(a,b,c){a.push("C",bQ(bR,b),",",bQ(bR,c),",",bQ(bS,b),",",bQ(bS,c),",",bQ(bT,b),",",bQ(bT,c))}function bQ(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function bP(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[bQ(bT,g),",",bQ(bT,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),bU(b,g,h);return b.join("")}function bO(a){if(a.length<4)return bF(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(bQ(bT,f)+","+bQ(bT,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),bU(b,f,g);return b.join("")}function bN(a){if(a.length<3)return bF(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),bU(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bU(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bU(b,h,i);return b.join("")}function bM(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function bL(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bF(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function bK(a,b,c){return a.length<3?bF(a):a[0]+bL(a,bM(a,b))}function bJ(a,b){return a.length<3?bF(a):a[0]+bL((a.push(a[0]),a),bM([a[a.length-2]].concat(a,[a[1]]),b))}function bI(a,b){return a.length<4?bF(a):a[1]+bL(a.slice(1,a.length-1),bM(a,b))}function bH(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bG(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bF(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bD(a){return a[1]}function bC(a){return a[0]}function bB(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bA(a){return a.endAngle}function bz(a){return a.startAngle}function by(a){return a.outerRadius}function bx(a){return a.innerRadius}function bq(a){return function(b){return-Math.pow(-b,a)}}function bp(a){return function(b){return Math.pow(b,a)}}function bo(a){return-Math.log(-a)/Math.LN10}function bn(a){return Math.log(a)/Math.LN10}function bm(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function bl(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bk(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bj(){return Math}function bi(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bg(){var a=null,b=bb,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bb=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bf(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,a>c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bg()-b;d>24?(isFinite(d)&&(clearTimeout(bd),bd=setTimeout(bf,d)),bc=0):(bc=1,bh(bf))}function be(a,b){var c=Date.now(),d=!1,e,f=bb;if(!!isFinite(b)){while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bb={callback:a,then:c,delay:b,next:bb}),bc||(bd=clearTimeout(bd),bc=1,bh(bf))}}function ba(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function _(a){function n(b){var h=!0,l=-1;a.each(function(){if(i[++l]!==2){var a=(b-j[l])/k[l],n=this.__transition__,o,p,q=e[l];if(a<1){h=!1;if(a<0)return}else a=1;if(i[l]){if(!n||n.active!==c){i[l]=2;return}}else{if(!n||n.active>c){i[l]=2;return}i[l]=1,g.start.dispatch.apply(this,arguments),q=e[l]={},n.active=c;for(p in d)if(o=d[p].apply(this,arguments))q[p]=o}o=m(a);for(p in q)q[p].call(this,o);if(a===1){i[l]=2;if(n.active===c){var r=n.owner;r===c&&(delete this.__transition__,f&&this.parentNode.removeChild(this)),$=c,g.end.dispatch.apply(this,arguments),$=0,n.owner=r}}}});return h}var b={},c=$||++Z,d={},e=[],f=!1,g=d3.dispatch("start","end"),i=[],j=[],k=[],l,m=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=c}),b.delay=function(c){var d=Infinity,e=-1;typeof c=="function"?a.each(function(a,b){var f=j[++e]=+c.apply(this,arguments);f<d&&(d=f)}):(d=+c,a.each(function(a,b){j[++e]=d})),be(n,d);return b},b.duration=function(c){var d=-1;typeof c=="function"?(l=0,a.each(function(a,b){var e=k[++d]=+c.apply(this,arguments);e>l&&(l=e)})):(l=+c,a.each(function(a,b){k[++d]=l}));return b},b.ease=function(a){m=typeof a=="function"?a:d3.ease.apply(d3,arguments);return b},b.attrTween=function(a,c){function f(b,d){var e=c.call(this,b,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function e(b,d){var e=c.call(this,b,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}d["attr."+a]=a.local?f:e;return b},b.attr=function(a,c){return b.attrTween(a,ba(c))},b.styleTween=function(a,c,e){function f(b,d){var f=c.call(this,b,d,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),e)}}arguments.length<3&&(e=null),d["style."+a]=f;return b},b.style=function(a,c,d){arguments.length<3&&(d=null);return b.styleTween(a,ba(c),d)},b.text=function(a){d.text=function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a};return b},b.select=function(b){var c,d=_(a.select(b)).ease(m);c=-1,d.delay(function(a,b){return j[++c]}),c=-1,d.duration(function(a,b){return k[++c]});return d},b.selectAll=function(b){var c,d=_(a.selectAll(b)).ease(m);c=-1,d.delay(function(a,b){return j[b?c:++c]}),c=-1,d.duration(function(a,b){return k[b?c:++c]});return d},b.remove=function(){f=!0;return b},b.each=function(a,c){g[a].add(c);return b},b.call=h;return b.delay(0).duration(250)}function Y(a){return{__data__:a}}function X(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function W(a){function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(f.parentNode)),e.__data__=g.__data__):d.push(null)}return V(c)}a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)};return a}function V(a){function d(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];if(h)return b.call(h,h.__data__,f)}}return null}function c(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g];for(var i=0,j=e.length;i<j;i++)if(f=e[i])c.push(d=b(f)),d.parentNode=f}return V(c)}function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(g)),e&&"__data__"in g&&(e.__data__=g.__data__)):d.push(null)}return V(c)}a.select=function(a){return b(function(b){return S(a,b)})},a.selectAll=function(a){return c(function(b){return T(a,b)})},a.filter=function(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g],c.push(d=[]),d.parentNode=e.parentNode;for(var i=0,j=e.length;i<j;i++)(f=e[i])&&b.call(f,f.__data__,i)&&d.push(f)}return V(c)},a.map=function(b){var c,d;for(var e=0,f=a.length;e<f;e++){c=a[e];for(var g=0,h=c.length;g<h;g++)if(d=c[g])d.__data__=b.call(d,d.__data__,g)}return a},a.data=function(b,c){function g(a,b){var g=0,h=a.length,i=b.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(c){var q={},r=[],s,t=b.length;for(g=0;g<h;g++)s=c.call(o=a[g],o.__data__,g),s in q?n[t++]=a[g]:q[s]=o,r.push(s);for(g=0;g<i;g++)o=q[s=c.call(b,p=b[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Y(p),l[g]=n[g]=null),delete q[s];for(g=0;g<h;g++)r[g]in q&&(n[g]=a[g])}else{for(;g<j;g++)o=a[g],p=b[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Y(p),l[g]=n[g]=null);for(;g<i;g++)m[g]=Y(b[g]),l[g]=n[g]=null;for(;g<k;g++)n[g]=a[g],m[g]=l[g]=null}m.parentNode=l.parentNode=n.parentNode=a.parentNode,d.push(m),e.push(l),f.push(n)}var d=[],e=[],f=[],h=-1,i=a.length,j;if(typeof b=="function")while(++h<i)g(j=a[h],b.call(j,j.parentNode.__data__,h));else while(++h<i)g(j=a[h],b);var k=V(e);k.enter=function(){return W(d)},k.exit=function(){return V(f)};return k},a.each=function(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];h&&b.call(h,h.__data__,f)}}return a},a.empty=function(){return!d(function(){return!0})},a.node=function(){return d(function(){return this})},a.attr=function(b,c){function j(){var a=c.apply(this,arguments);a==null?this.removeAttributeNS(b.space,b.local):this.setAttributeNS(b.space,b.local,a)}function i(){var a=c.apply(this,arguments);a==null?this.removeAttribute(b):this.setAttribute(b,a)}function h(){this.setAttributeNS(b.space,b.local,c)}function g(){this.setAttribute(b,c)}function f(){this.removeAttributeNS(b.space,b.local)}function e(){this.removeAttribute(b)}b=d3.ns.qualify(b);if(arguments.length<2)return d(b.local?function(){return this.getAttributeNS(b.space,b.local)}:function(){return this.getAttribute(b)});return a.each(c==null?b.local?f:e:typeof c=="function"?b.local?j:i:b.local?h:g)},a.classed=function(b,c){function i(){(c.apply(this,arguments)?f:h).call(this)}function h(){if(a=this.classList)return a.remove(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;d=g(d.replace(e," ")),c?a.baseVal=d:this.className=d}function f(){if(a=this.classList)return a.add(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;e.lastIndex=0,e.test(d)||(d=g(d+" "+b),c?a.baseVal=d:this.className=d)}var e=new RegExp("(^|\\s+)"+d3.requote(b)+"(\\s+|$)","g");if(arguments.length<2)return d(function(){if(a=this.classList)return a.contains(b);var a=this.className;e.lastIndex=0;return e.test(a.baseVal!=null?a.baseVal:a)});return a.each(typeof c=="function"?i:c?f:h)},a.style=function(b,c,e){function h(){var a=c.apply(this,arguments);a==null?this.style.removeProperty(b):this.style.setProperty(b,a,e)}function g(){this.style.setProperty(b,c,e)}function f(){this.style.removeProperty(b)}arguments.length<3&&(e="");if(arguments.length<2)return d(function(){return window.getComputedStyle(this,null).getPropertyValue(b)});return a.each(c==null?f:typeof c=="function"?h:g)},a.property=function(b,c){function g(){var a=c.apply(this,arguments);a==null?delete this[b]:this[b]=a}function f(){this[b]=c}function e(){delete this[b]}b=d3.ns.qualify(b);if(arguments.length<2)return d(function(){return this[b]});return a.each(c==null?e:typeof c=="function"?g:f)},a.text=function(b){function e(){this.textContent=b.apply(this,arguments)}function c(){this.textContent=b}if(arguments.length<1)return d(function(){return this.textContent});return a.each(typeof b=="function"?e:c)},a.html=function(b){function e(){this.innerHTML=b.apply(this,arguments)}function c(){this.innerHTML=b}if(arguments.length<1)return d(function(){return this.innerHTML});return a.each(typeof b=="function"?e:c)},a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)},a.remove=function(){return a.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},a.sort=function(b){b=X.apply(this,arguments);for(var c=0,d=a.length;c<d;c++){var e=a[c];e.sort(b);for(var f=1,g=e.length,h=e[0];f<g;f++){var i=e[f];i&&(h&&h.parentNode.insertBefore(i,h.nextSibling),h=i)}}return a},a.on=function(b,c,d){arguments.length<3&&(d=!1);var e=b.indexOf("."),f=e===-1?b:b.substring(0,e),g="__on"+b;return a.each(function(a,b){function h(a){var d=d3.event;d3.event=a;try{c.call(this,e.__data__,b)}finally{d3.event=d}}this[g]&&this.removeEventListener(f,this[g],d),c&&this.addEventListener(f,this[g]=h,d);var e=this})},a.transition=function(){return _(a)},a.call=h;return a}function R(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);if(a<60)return d+(e-d)*a/60;if(a<180)return e;if(a<240)return d+(e-d)*(240-a)/60;return d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return H(g(a+120),g(a),g(a-120))}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function P(a,b,c){return new Q(a,b,c)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function L(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return P(g,h,i)}function K(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(M(h[0]),M(h[1]),M(h[2]))}}if(i=N[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function J(a){return a<16?"0"+a.toString(16):a.toString(16)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function H(a,b,c){return new I(a,b,c)}function G(a,b){b=1/(b-(a=+a));return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function F(a,b){b=1/(b-(a=+a));return function(c){return(c-a)*b}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function B(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function A(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function z(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function y(a){return 1-Math.sqrt(1-a*a)}function x(a){return a?Math.pow(2,10*(a-1))-.001:0}function w(a){return 1-Math.cos(a*Math.PI/2)}function v(a){return function(b){return Math.pow(b,a)}}function u(a){return a}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function s(a){return function(b){return 1-a(1-b)}}function n(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function m(a){return a+""}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){a.apply(this,(arguments[0]=this,arguments));return this}function g(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function f(a){return a==null}function e(a){return a.length}function c(a){return Array.prototype.slice.call(a)}function b(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}d3={version:"1.21.0"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=c;try{a(document.documentElement.childNodes)[0].nodeType}catch(d){a=b}d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:0},d3.descending=function(a,b){return b<a?-1:b>a?1:0},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.zip=function(){if(!(f=arguments.length))return[];for(var a=-1,b=d3.min(arguments,e),c=Array(b);++a<b;)for(var d=-1,f,g=c[a]=Array(f);++d<f;)g[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,g=-1,h=a.length;arguments.length<2&&(b=f);while(++g<h)b.call(d,e=a[g],g)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length===1&&(b=a,a=0),c==null&&(c=1);if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(i,"\\$&")};var i=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=j(c);return b},d3.format=function(a){var b=k.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=!1,o=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":o=!0,h="0"}i=l[i]||m;return function(a){var b=j?a*100:+a,k=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=i(b,h);if(e){var l=a.length+k.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=n(a)),a=k+a}else{g&&(a=n(a)),a=k+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}j&&(a+="%");return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,b-c))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return r[d](q[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;C.lastIndex=0;for(d=0;c=C.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;if(h.length===1)return h[0]==null?i[0].x:function(){return b};return function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return R(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=E(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(b in N||/^(#|rgb\(|hsl\()/.test(b))&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return H(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},I.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var S=function(a,b){return b.querySelector(a)},T=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(S=function(a,b){return Sizzle(a,b)[0]},T=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var U=V([[document]]);U[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?U.select(a):V([[a]])},d3.selectAll=function(b){return typeof b=="string"?U.selectAll(b):V([a(b)])},d3.transition=U.transition;var Z=0,$=0,bb=null,bc,bd;d3.timer=function(a){be(a,0)},d3.timer.flush=function(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bg()};var bh=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){function i(b){var c=d3.min(a),d=d3.max(a),e=d-c,f=Math.pow(10,Math.floor(Math.log(e/b)/Math.LN10)),g=b/(e/f);g<=.15?f*=10:g<=.35?f*=5:g<=.75&&(f*=2);return{start:Math.ceil(c/f)*f,stop:Math.floor(d/f)*f+f*.5,step:f}}function h(a){return e(a)}function g(){var g=a.length==2?bl:bm,i=d?G:F;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var a=[0,1],b=[0,1],c=d3.interpolate,d=!1,e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(a){var b=i(a);return d3.range(b.start,b.stop,b.step)},h.tickFormat=function(a){var b=Math.max(0,-Math.floor(Math.log(i(a).step)/Math.LN10+.01));return d3.format(",."+b+"f")},h.nice=function(){bi(a,bk);return g()};return g()},d3.scale.log=function(){function d(c){return a(b(c))}var a=d3.scale.linear(),b=bn,c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=(e[0]||e[1])<0?bo:bn,c=b.pow,a.domain(e.map(b));return d},d.range=d3.rebind(d,a.range),d.rangeRound=d3.rebind(d,a.rangeRound),d.interpolate=d3.rebind(d,a.interpolate),d.clamp=d3.rebind(d,a.clamp),d.nice=function(){a.domain(bi(a.domain(),bj));return d},d.ticks=function(){var d=a.domain(),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===bo){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return function(a){return a.toPrecision(1)}};return d},bn.pow=function(a){return Math.pow(10,a)},bo.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){function f <del>(b){return a(d(b))}var a=d3.scale.linear(),b=d3.scale.linear(),c=1,d=Number,e=d;f.invert=function(b){return e(a.invert(b))},f.domain=function(g){if(!arguments.length)return a.domain().map(e);var h=(g[0]||g[1])<0?bq:bp;d=h(c),e=h(1/c),a.domain(g.map(d)),b.domain(g);return f},f.range=d3.rebind(f,a.range),f.rangeRound=d3.rebind(f,a.rangeRound),f.interpolate=d3.rebind(f,a.interpolate),f.clamp=d3.rebind(f,a.clamp),f.ticks=b.ticks,f.tickFormat=b.tickFormat,f.nice=function(){return f.domain(bi(f.domain(),bk))},f.exponent=function(a){if(!arguments.length)return c;var b=f.domain();c=a;return f.domain(b)};return f},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){function e(d){var e=d in b?b[d]:b[d]=a.push(d)-1;return c[e%c.length]}var a=[],b={},c=[],d=0;e.domain=function(c){if(!arguments.length)return a;a=c,b={};var d=-1,f=-1,g=a.length;while(++d<g)c=a[d],c in b||(b[c]=++f);return e},e.range=function(a){if(!arguments.length)return c;c=a;return e},e.rangePoints=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=(h-g)/(a.length-1+f);c=a.length==1?[(g+h)/2]:d3.range(g+i*f/2,h+i/2,i),d=0;return e},e.rangeBands=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=(h-g)/(a.length+f);c=d3.range(g+i*f,h,i),d=i*(1-f);return e},e.rangeRoundBands=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=h-g,j=Math.floor(i/(a.length+f)),k=i-(a.length-f)*j;c=d3.range(g+Math.round(k/2),h,j),d=Math.round(j*(1-f));return e},e.rangeBand=function(){return d};return e},d3.scale.category10=function(){return d3.scale.ordinal().range(br)},d3.scale.category20=function(){return d3.scale.ordinal().range(bs)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bt)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bu)};var br=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bs=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bt=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bu=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function e(a){if(isNaN(a=+a))return NaN;return b[d3.bisect(c,a)]}function d(){var d=0,e=a.length,f=b.length,g;c.length=Math.max(0,f-1);while(++d<f)c[d-1]=(g=e*d/f)%1?a[~~g]:(a[g=~~g]+a[g-1])/2}var a=[],b=[],c=[];e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d();return e},e.range=function(a){if(!arguments.length)return b;b=a,d();return e},e.quantiles=function(){return c};return e},d3.scale.quantize=function(){function f(b){return e[Math.max(0,Math.min(d,Math.floor(c*(b-a))))]}var a=0,b=1,c=2,d=1,e=[0,1];f.domain=function(d){if(!arguments.length)return[a,b];a=d[0],b=d[1],c=e.length/(b-a);return f},f.range=function(g){if(!arguments.length)return e;e=g,c=e.length/(b-a),d=e.length-1;return f};return f},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bv,h=d.apply(this,arguments)+bv,i=h-g,j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bw?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bx,b=by,c=bz,d=bA;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bv;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bv=-Math.PI/2,bw=2*Math.PI-1e-6;d3.svg.line=function(){function f(c){return c.length<1?null:"M"+d(bB(this,c,a,b),e)}var a=bC,b=bD,c="linear",d=bE[c],e=.7;f.x=function(b){if(!arguments.length)return a;a=b;return f},f.y=function(a){if(!arguments.length)return b;b=a;return f},f.interpolate=function(a){if(!arguments.length)return c;d=bE[c=a];return f},f.tension=function(a){if(!arguments.length)return e;e=a;return f};return f};var bE={linear:bF,"step-before":bG,"step-after":bH,basis:bN,"basis-open":bO,"basis-closed":bP,cardinal:bK,"cardinal-open":bI,"cardinal-closed":bJ,monotone:bY},bR=[0,2/3,1/3,0],bS=[0,1/3,2/3,0],bT=[0,1/6,2/3,1/6];d3.svg.area=function(){function g(d){return d.length<1?null:"M"+e(bB(this,d,a,c),f)+"L"+e(bB(this,d,a,b).reverse(),f)+"Z"}var a=bC,b=bZ,c=bD,d="linear",e=bE[d],f=.7;g.x=function(b){if(!arguments.length)return a;a=b;return g},g.y0=function(a){if(!arguments.length)return b;b=a;return g},g.y1=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bE[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bv,k=e.call(a,h,g)+bv;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=b$,b=b_,c=ca,d=bz,e=bA;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=b$,b=b_,c=cd;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.mouse=function(a){return cf(a,d3.event)};var ce=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(b){var c=d3.event.touches;return c?a(c).map(function(a){var c=cf(b,a);c.identifier=a.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(ci[a.call(this,c,d)]||ci.circle)(b.call(this,c,d))}var a=ch,b=cg;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var ci={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*ck)),c=b*ck;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/cj),c=b*cj/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cj),c=b*cj/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(ci);var cj=Math.sqrt(3),ck=Math.tan(30*Math.PI/180)})() <ide>\ No newline at end of file <add>(function(){function cg(){return"circle"}function cf(){return 64}function ce(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cd<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cd=!e.f&&!e.e,d.remove()}cd?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function cc(a){return[a.x,a.y]}function cb(a){return a.endAngle}function ca(a){return a.startAngle}function b_(a){return a.radius}function b$(a){return a.target}function bZ(a){return a.source}function bY(a){return a.length<3?bF(a):a[0]+bL(a,bX(a))}function bX(a){var b=[],c,d,e,f,g=bW(a),h=-1,i=a.length-1;while(++h<i)c=bV(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function bW(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=bV(e,f);while(++b<c)d[b]=g+(g=bV(e=f,f=a[b+1]));d[b]=g;return d}function bV(a,b){return(b[1]-a[1])/(b[0]-a[0])}function bU(a,b,c){a.push("C",bQ(bR,b),",",bQ(bR,c),",",bQ(bS,b),",",bQ(bS,c),",",bQ(bT,b),",",bQ(bT,c))}function bQ(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function bP(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[bQ(bT,g),",",bQ(bT,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),bU(b,g,h);return b.join("")}function bO(a){if(a.length<4)return bF(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(bQ(bT,f)+","+bQ(bT,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),bU(b,f,g);return b.join("")}function bN(a){if(a.length<3)return bF(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),bU(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bU(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),bU(b,h,i);return b.join("")}function bM(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function bL(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bF(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function bK(a,b,c){return a.length<3?bF(a):a[0]+bL(a,bM(a,b))}function bJ(a,b){return a.length<3?bF(a):a[0]+bL((a.push(a[0]),a),bM([a[a.length-2]].concat(a,[a[1]]),b))}function bI(a,b){return a.length<4?bF(a):a[1]+bL(a.slice(1,a.length-1),bM(a,b))}function bH(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bG(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bF(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bD(a){return a[1]}function bC(a){return a[0]}function bB(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bA(a){return a.endAngle}function bz(a){return a.startAngle}function by(a){return a.outerRadius}function bx(a){return a.innerRadius}function bq(a){return function(b){return-Math.pow(-b,a)}}function bp(a){return function(b){return Math.pow(b,a)}}function bo(a){return-Math.log(-a)/Math.LN10}function bn(a){return Math.log(a)/Math.LN10}function bm(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function bl(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bk(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bj(){return Math}function bi(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bg(){var a=null,b=bb,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bb=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bf(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,a>c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bg()-b;d>24?(isFinite(d)&&(clearTimeout(bd),bd=setTimeout(bf,d)),bc=0):(bc=1,bh(bf))}function be(a,b){var c=Date.now(),d=!1,e,f=bb;if(!!isFinite(b)){while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bb={callback:a,then:c,delay:b,next:bb}),bc||(bd=clearTimeout(bd),bc=1,bh(bf))}}function ba(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function _(a){function n(b){var h=!0,l=-1;a.each(function(){if(i[++l]!==2){var a=(b-j[l])/k[l],n=this.__transition__,o,p,q=e[l];if(a<1){h=!1;if(a<0)return}else a=1;if(i[l]){if(!n||n.active!==c){i[l]=2;return}}else{if(!n||n.active>c){i[l]=2;return}i[l]=1,g.start.dispatch.apply(this,arguments),q=e[l]={},n.active=c;for(p in d)if(o=d[p].apply(this,arguments))q[p]=o}o=m(a);for(p in q)q[p].call(this,o);if(a===1){i[l]=2;if(n.active===c){var r=n.owner;r===c&&(delete this.__transition__,f&&this.parentNode.removeChild(this)),$=c,g.end.dispatch.apply(this,arguments),$=0,n.owner=r}}}});return h}var b={},c=$||++Z,d={},e=[],f=!1,g=d3.dispatch("start","end"),i=[],j=[],k=[],l,m=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=c}),b.delay=function(c){var d=Infinity,e=-1;typeof c=="function"?a.each(function(a,b){var f=j[++e]=+c.apply(this,arguments);f<d&&(d=f)}):(d=+c,a.each(function(a,b){j[++e]=d})),be(n,d);return b},b.duration=function(c){var d=-1;typeof c=="function"?(l=0,a.each(function(a,b){var e=k[++d]=+c.apply(this,arguments);e>l&&(l=e)})):(l=+c,a.each(function(a,b){k[++d]=l}));return b},b.ease=function(a){m=typeof a=="function"?a:d3.ease.apply(d3,arguments);return b},b.attrTween=function(a,c){function f(b,d){var e=c.call(this,b,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function e(b,d){var e=c.call(this,b,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}d["attr."+a]=a.local?f:e;return b},b.attr=function(a,c){return b.attrTween(a,ba(c))},b.styleTween=function(a,c,e){function f(b,d){var f=c.call(this,b,d,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),e)}}arguments.length<3&&(e=null),d["style."+a]=f;return b},b.style=function(a,c,d){arguments.length<3&&(d=null);return b.styleTween(a,ba(c),d)},b.text=function(a){d.text=function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a};return b},b.select=function(b){var c,d=_(a.select(b)).ease(m);c=-1,d.delay(function(a,b){return j[++c]}),c=-1,d.duration(function(a,b){return k[++c]});return d},b.selectAll=function(b){var c,d=_(a.selectAll(b)).ease(m);c=-1,d.delay(function(a,b){return j[b?c:++c]}),c=-1,d.duration(function(a,b){return k[b?c:++c]});return d},b.remove=function(){f=!0;return b},b.each=function(a,c){g[a].add(c);return b},b.call=h;return b.delay(0).duration(250)}function Y(a){return{__data__:a}}function X(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function W(a){function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(f.parentNode)),e.__data__=g.__data__):d.push(null)}return V(c)}a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)};return a}function V(a){function d(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];if(h)return b.call(h,h.__data__,f)}}return null}function c(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g];for(var i=0,j=e.length;i<j;i++)if(f=e[i])c.push(d=b(f)),d.parentNode=f}return V(c)}function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(g)),e&&"__data__"in g&&(e.__data__=g.__data__)):d.push(null)}return V(c)}a.select=function(a){return b(function(b){return S(a,b)})},a.selectAll=function(a){return c(function(b){return T(a,b)})},a.filter=function(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g],c.push(d=[]),d.parentNode=e.parentNode;for(var i=0,j=e.length;i<j;i++)(f=e[i])&&b.call(f,f.__data__,i)&&d.push(f)}return V(c)},a.map=function(b){var c,d;for(var e=0,f=a.length;e<f;e++){c=a[e];for(var g=0,h=c.length;g<h;g++)if(d=c[g])d.__data__=b.call(d,d.__data__,g)}return a},a.data=function(b,c){function g(a,b){var g=0,h=a.length,i=b.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(c){var q={},r=[],s,t=b.length;for(g=0;g<h;g++)s=c.call(o=a[g],o.__data__,g),s in q?n[t++]=a[g]:q[s]=o,r.push(s);for(g=0;g<i;g++)o=q[s=c.call(b,p=b[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Y(p),l[g]=n[g]=null),delete q[s];for(g=0;g<h;g++)r[g]in q&&(n[g]=a[g])}else{for(;g<j;g++)o=a[g],p=b[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Y(p),l[g]=n[g]=null);for(;g<i;g++)m[g]=Y(b[g]),l[g]=n[g]=null;for(;g<k;g++)n[g]=a[g],m[g]=l[g]=null}m.parentNode=l.parentNode=n.parentNode=a.parentNode,d.push(m),e.push(l),f.push(n)}var d=[],e=[],f=[],h=-1,i=a.length,j;if(typeof b=="function")while(++h<i)g(j=a[h],b.call(j,j.parentNode.__data__,h));else while(++h<i)g(j=a[h],b);var k=V(e);k.enter=function(){return W(d)},k.exit=function(){return V(f)};return k},a.each=function(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];h&&b.call(h,h.__data__,f)}}return a},a.empty=function(){return!d(function(){return!0})},a.node=function(){return d(function(){return this})},a.attr=function(b,c){function j(){var a=c.apply(this,arguments);a==null?this.removeAttributeNS(b.space,b.local):this.setAttributeNS(b.space,b.local,a)}function i(){var a=c.apply(this,arguments);a==null?this.removeAttribute(b):this.setAttribute(b,a)}function h(){this.setAttributeNS(b.space,b.local,c)}function g(){this.setAttribute(b,c)}function f(){this.removeAttributeNS(b.space,b.local)}function e(){this.removeAttribute(b)}b=d3.ns.qualify(b);if(arguments.length<2)return d(b.local?function(){return this.getAttributeNS(b.space,b.local)}:function(){return this.getAttribute(b)});return a.each(c==null?b.local?f:e:typeof c=="function"?b.local?j:i:b.local?h:g)},a.classed=function(b,c){function i(){(c.apply(this,arguments)?f:h).call(this)}function h(){if(a=this.classList)return a.remove(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;d=g(d.replace(e," ")),c?a.baseVal=d:this.className=d}function f(){if(a=this.classList)return a.add(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;e.lastIndex=0,e.test(d)||(d=g(d+" "+b),c?a.baseVal=d:this.className=d)}var e=new RegExp("(^|\\s+)"+d3.requote(b)+"(\\s+|$)","g");if(arguments.length<2)return d(function(){if(a=this.classList)return a.contains(b);var a=this.className;e.lastIndex=0;return e.test(a.baseVal!=null?a.baseVal:a)});return a.each(typeof c=="function"?i:c?f:h)},a.style=function(b,c,e){function h(){var a=c.apply(this,arguments);a==null?this.style.removeProperty(b):this.style.setProperty(b,a,e)}function g(){this.style.setProperty(b,c,e)}function f(){this.style.removeProperty(b)}arguments.length<3&&(e="");if(arguments.length<2)return d(function(){return window.getComputedStyle(this,null).getPropertyValue(b)});return a.each(c==null?f:typeof c=="function"?h:g)},a.property=function(b,c){function g(){var a=c.apply(this,arguments);a==null?delete this[b]:this[b]=a}function f(){this[b]=c}function e(){delete this[b]}b=d3.ns.qualify(b);if(arguments.length<2)return d(function(){return this[b]});return a.each(c==null?e:typeof c=="function"?g:f)},a.text=function(b){function e(){this.textContent=b.apply(this,arguments)}function c(){this.textContent=b}if(arguments.length<1)return d(function(){return this.textContent});return a.each(typeof b=="function"?e:c)},a.html=function(b){function e(){this.innerHTML=b.apply(this,arguments)}function c(){this.innerHTML=b}if(arguments.length<1)return d(function(){return this.innerHTML});return a.each(typeof b=="function"?e:c)},a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)},a.remove=function(){return a.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},a.sort=function(b){b=X.apply(this,arguments);for(var c=0,d=a.length;c<d;c++){var e=a[c];e.sort(b);for(var f=1,g=e.length,h=e[0];f<g;f++){var i=e[f];i&&(h&&h.parentNode.insertBefore(i,h.nextSibling),h=i)}}return a},a.on=function(b,c,d){arguments.length<3&&(d=!1);var e=b.indexOf("."),f=e===-1?b:b.substring(0,e),g="__on"+b;return a.each(function(a,b){function h(a){var d=d3.event;d3.event=a;try{c.call(this,e.__data__,b)}finally{d3.event=d}}this[g]&&this.removeEventListener(f,this[g],d),c&&this.addEventListener(f,this[g]=h,d);var e=this})},a.transition=function(){return _(a)},a.call=h;return a}function R(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);if(a<60)return d+(e-d)*a/60;if(a<180)return e;if(a<240)return d+(e-d)*(240-a)/60;return d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return H(g(a+120),g(a),g(a-120))}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function P(a,b,c){return new Q(a,b,c)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function L(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return P(g,h,i)}function K(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(M(h[0]),M(h[1]),M(h[2]))}}if(i=N[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function J(a){return a<16?"0"+a.toString(16):a.toString(16)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function H(a,b,c){return new I(a,b,c)}function G(a,b){b=1/(b-(a=+a));return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function F(a,b){b=1/(b-(a=+a));return function(c){return(c-a)*b}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function B(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function A(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function z(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function y(a){return 1-Math.sqrt(1-a*a)}function x(a){return a?Math.pow(2,10*(a-1))-.001:0}function w(a){return 1-Math.cos(a*Math.PI/2)}function v(a){return function(b){return Math.pow(b,a)}}function u(a){return a}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function s(a){return function(b){return 1-a(1-b)}}function n(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function m(a){return a+""}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){a.apply(this,(arguments[0]=this,arguments));return this}function g(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function f(a){return a==null}function e(a){return a.length}function c(a){return Array.prototype.slice.call(a)}function b(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}d3={version:"1.21.0"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=c;try{a(document.documentElement.childNodes)[0].nodeType}catch(d){a=b}d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:0},d3.descending=function(a,b){return b<a?-1:b>a?1:0},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.zip=function(){if(!(f=arguments.length))return[];for(var a=-1,b=d3.min(arguments,e),c=Array(b);++a<b;)for(var d=-1,f,g=c[a]=Array(f);++d<f;)g[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,g=-1,h=a.length;arguments.length<2&&(b=f);while(++g<h)b.call(d,e=a[g],g)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length===1&&(b=a,a=0),c==null&&(c=1);if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(i,"\\$&")};var i=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=j(c);return b},d3.format=function(a){var b=k.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=!1,o=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":o=!0,h="0"}i=l[i]||m;return function(a){var b=j?a*100:+a,k=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=i(b,h);if(e){var l=a.length+k.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=n(a)),a=k+a}else{g&&(a=n(a)),a=k+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}j&&(a+="%");return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,b-c))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return r[d](q[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;C.lastIndex=0;for(d=0;c=C.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;if(h.length===1)return h[0]==null?i[0].x:function(){return b};return function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return R(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=E(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(b in N||/^(#|rgb\(|hsl\()/.test(b))&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return H(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},I.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var S=function(a,b){return b.querySelector(a)},T=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(S=function(a,b){return Sizzle(a,b)[0]},T=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var U=V([[document]]);U[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?U.select(a):V([[a]])},d3.selectAll=function(b){return typeof b=="string"?U.selectAll(b):V([a(b)])},d3.transition=U.transition;var Z=0,$=0,bb=null,bc,bd;d3.timer=function(a){be(a,0)},d3.timer.flush=function(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bg()};var bh=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){function i(b){var c=d3.min(a),d=d3.max(a),e=d-c,f=Math.pow(10,Math.floor(Math.log(e/b)/Math.LN10)),g=b/(e/f);g<=.15?f*=10:g<=.35?f*=5:g<=.75&&(f*=2);return{start:Math.ceil(c/f)*f,stop:Math.floor(d/f)*f+f*.5,step:f}}function h(a){return e(a)}function g(){var g=a.length==2?bl:bm,i=d?G:F;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var a=[0,1],b=[0,1],c=d3.interpolate,d=!1,e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(a){var b=i(a);return d3.range(b.start,b.stop,b.step)},h.tickFormat=function(a){var b=Math.max(0,-Math.floor(Math.log(i(a).step)/Math.LN10+.01));return d3.format(",."+b+"f")},h.nice=function(){bi(a,bk);return g()};return g()},d3.scale.log=function(){function d(c){return a(b(c))}var a=d3.scale.linear(),b=bn,c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=(e[0]||e[1])<0?bo:bn,c=b.pow,a.domain(e.map(b));return d},d.range=d3.rebind(d,a.range),d.rangeRound=d3.rebind(d,a.rangeRound),d.interpolate=d3.rebind(d,a.interpolate),d.clamp=d3.rebind(d,a.clamp),d.nice=function(){a.domain(bi(a.domain(),bj));return d},d.ticks=function(){var d=a.domain(),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===bo){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return function(a){return a.toPrecision(1)}};return d},bn.pow=function(a){return Math.pow(10,a)},bo.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){function f(b){return a(d(b))} <add>var a=d3.scale.linear(),b=d3.scale.linear(),c=1,d=Number,e=d;f.invert=function(b){return e(a.invert(b))},f.domain=function(g){if(!arguments.length)return a.domain().map(e);var h=(g[0]||g[1])<0?bq:bp;d=h(c),e=h(1/c),a.domain(g.map(d)),b.domain(g);return f},f.range=d3.rebind(f,a.range),f.rangeRound=d3.rebind(f,a.rangeRound),f.interpolate=d3.rebind(f,a.interpolate),f.clamp=d3.rebind(f,a.clamp),f.ticks=b.ticks,f.tickFormat=b.tickFormat,f.nice=function(){return f.domain(bi(f.domain(),bk))},f.exponent=function(a){if(!arguments.length)return c;var b=f.domain();c=a;return f.domain(b)};return f},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){function e(d){var e=d in b?b[d]:b[d]=a.push(d)-1;return c[e%c.length]}var a=[],b={},c=[],d=0;e.domain=function(c){if(!arguments.length)return a;a=c,b={};var d=-1,f=-1,g=a.length;while(++d<g)c=a[d],c in b||(b[c]=++f);return e},e.range=function(a){if(!arguments.length)return c;c=a;return e},e.rangePoints=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=(h-g)/(a.length-1+f);c=a.length==1?[(g+h)/2]:d3.range(g+i*f/2,h+i/2,i),d=0;return e},e.rangeBands=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=(h-g)/(a.length+f);c=d3.range(g+i*f,h,i),d=i*(1-f);return e},e.rangeRoundBands=function(b,f){arguments.length<2&&(f=0);var g=b[0],h=b[1],i=h-g,j=Math.floor(i/(a.length+f)),k=i-(a.length-f)*j;c=d3.range(g+Math.round(k/2),h,j),d=Math.round(j*(1-f));return e},e.rangeBand=function(){return d};return e},d3.scale.category10=function(){return d3.scale.ordinal().range(br)},d3.scale.category20=function(){return d3.scale.ordinal().range(bs)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bt)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bu)};var br=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bs=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bt=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bu=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function e(a){if(isNaN(a=+a))return NaN;return b[d3.bisect(c,a)]}function d(){var d=0,e=a.length,f=b.length,g;c.length=Math.max(0,f-1);while(++d<f)c[d-1]=(g=e*d/f)%1?a[~~g]:(a[g=~~g]+a[g-1])/2}var a=[],b=[],c=[];e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d();return e},e.range=function(a){if(!arguments.length)return b;b=a,d();return e},e.quantiles=function(){return c};return e},d3.scale.quantize=function(){function f(b){return e[Math.max(0,Math.min(d,Math.floor(c*(b-a))))]}var a=0,b=1,c=2,d=1,e=[0,1];f.domain=function(d){if(!arguments.length)return[a,b];a=d[0],b=d[1],c=e.length/(b-a);return f},f.range=function(g){if(!arguments.length)return e;e=g,c=e.length/(b-a),d=e.length-1;return f};return f},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bv,h=d.apply(this,arguments)+bv,i=h-g,j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bw?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bx,b=by,c=bz,d=bA;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bv;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bv=-Math.PI/2,bw=2*Math.PI-1e-6;d3.svg.line=function(){function f(c){return c.length<1?null:"M"+d(bB(this,c,a,b),e)}var a=bC,b=bD,c="linear",d=bE[c],e=.7;f.x=function(b){if(!arguments.length)return a;a=b;return f},f.y=function(a){if(!arguments.length)return b;b=a;return f},f.interpolate=function(a){if(!arguments.length)return c;d=bE[c=a];return f},f.tension=function(a){if(!arguments.length)return e;e=a;return f};return f};var bE={linear:bF,"step-before":bG,"step-after":bH,basis:bN,"basis-open":bO,"basis-closed":bP,cardinal:bK,"cardinal-open":bI,"cardinal-closed":bJ,monotone:bY},bR=[0,2/3,1/3,0],bS=[0,1/3,2/3,0],bT=[0,1/6,2/3,1/6];d3.svg.area=function(){function g(d){return d.length<1?null:"M"+e(bB(this,d,a,c),f)+"L"+e(bB(this,d,a,b).reverse(),f)+"Z"}var a=bC,b=0,c=bD,d="linear",e=bE[d],f=.7;g.x=function(b){if(!arguments.length)return a;a=b;return g},g.y0=function(a){if(!arguments.length)return b;b=a;return g},g.y1=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bE[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bv,k=e.call(a,h,g)+bv;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=bZ,b=b$,c=b_,d=bz,e=bA;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=bZ,b=b$,c=cc;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.mouse=function(a){return ce(a,d3.event)};var cd=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(b){var c=d3.event.touches;return c?a(c).map(function(a){var c=ce(b,a);c.identifier=a.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(ch[a.call(this,c,d)]||ch.circle)(b.call(this,c,d))}var a=cg,b=cf;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var ch={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*cj)),c=b*cj;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/ci),c=b*ci/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/ci),c=b*ci/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(ch);var ci=Math.sqrt(3),cj=Math.tan(30*Math.PI/180)})() <ide>\ No newline at end of file <ide><path>src/svg/area.js <ide> d3.svg.area = function() { <ide> var x = d3_svg_lineX, <del> y0 = d3_svg_areaY0, <add> y0 = 0, <ide> y1 = d3_svg_lineY, <ide> interpolate = "linear", <ide> interpolator = d3_svg_lineInterpolators[interpolate], <ide> d3.svg.area = function() { <ide> <ide> return area; <ide> }; <del> <del>function d3_svg_areaY0() { <del> return 0; <del>}
3
Python
Python
use six to reload module
29f5ce7aeb57abde3924527f63bb761e0c2342d3
<ide><path>rest_framework/tests/utils.py <ide> from contextlib import contextmanager <add>from rest_framework.compat import six <ide> from rest_framework.settings import api_settings <ide> <ide> <ide> def temporary_setting(setting, value, module=None): <ide> setattr(api_settings, setting, value) <ide> <ide> if module is not None: <del> reload(module) <add> six.moves.reload_module(module) <ide> <ide> yield <ide> <ide> setattr(api_settings, setting, original_value) <ide> <ide> if module is not None: <del> reload(module) <add> six.moves.reload_module(module)
1
Javascript
Javascript
use object.prototype.hasownproperty for doc in ie8
550795445e04a1b2c985ce2f58b125d0abe2817d
<ide><path>src/browser/ReactEventEmitter.js <ide> var topEventMapping = { <ide> var topListenersIDKey = "_reactListenersID" + String(Math.random()).slice(2); <ide> <ide> function getListeningForDocument(mountAt) { <del> if (!mountAt.hasOwnProperty(topListenersIDKey)) { <add> // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` <add> // directly. <add> if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { <ide> mountAt[topListenersIDKey] = reactTopListenersCounter++; <ide> alreadyListeningTo[mountAt[topListenersIDKey]] = {}; <ide> }
1
Text
Text
add improvement of the translation
5e387d2561674978fb92328cfd662911d0071b83
<ide><path>guide/chinese/java/abstract-class/index.md <ide> localeTitle: Java中的抽象类 <ide> --- <ide> 让我们讨论抽象类。在深入学习本教程之前,最好先了解一下类的概念 和继承。 <ide> <del>抽象类是可以子类化(即扩展)但不能实例化的类。您可以将它们视为接口的**类版本** ,或者作为附加到方法的实际代码的接口。 <add>抽象类是可以子类化(即扩展)但不能实例化的类。您可以将它们视为接口的**类版本** ,或者作为方法中有具体代码的接口。 <ide> <ide> 请考虑以下示例来理解抽象类: 您有一个类Vehicle,它定义机器应具有的某些基本功能(方法)和某些组件(对象变量),以归类为车辆。您无法创建Vehicle的对象,因为车辆本身就是一个抽象概念。但是,您可以扩展车辆类的功能以创建汽车或摩托车。 <ide> <add>``` java <add>abstract class Vehicle <add>{ <add> //用于声明汽车轮胎数量的变量 <add> private int wheels; <add> <add> //用于定义发动机类型的变量 <add> private Motor motor; <add> <add> //抽象方法仅声明启动方法但不定义启动功能 <add> //应为每个汽车有不同的启动机制 <add> abstract void start(); <add>} <add> <add>public class Car extends Vehicle <add>{ <add> ... <add>} <add> <add>public class Motorcycle extends Vehicle <add>{ <add> ... <add>} <add>``` <add> <add>你不可以在你程序中创建Vehicle类的对象,但是你可以继承Vehicle类并且创建自类的对象。 <add> <ide> ```java <ide> 抽象类车辆 { //用于声明no的变量。在车辆中的车轮 私人车轮; <ide> //变量用于定义所用电机的类型 私人电机; <ide> localeTitle: Java中的抽象类 <ide> abstract void start(); <ide> } <ide> <del>公共类汽车扩展车辆 { ... } <del> <del>公共类摩托车扩展车辆 { ... } <del>``` <add>``` java <add>Vehicle newVehicle = new Vehicle(); // 无效 <add>Vehicle car = new Car(); // 有效 <add>Vehicle mBike = new Motorcycle(); // 有效 <add>Car carObj = new Car(); // 有效 <add>Motorcycle mBikeObj = new Motorcycle(); // 有效 <ide> ``` <del>You cannot create an object of Vehicle class anywhere in your program. You can however, extend the abstract vehicle class and create objects of the child classes; <del>``` <del> <del>```java <del>车辆newVehicle = new Vehicle(); //无效 车辆车=新车(); //有效 车辆mBike =新摩托车(); //有效 <ide> <del>Car carObj = new Car(); //有效 摩托车mBikeObj =新摩托车(); //有效 <del>```
1
Ruby
Ruby
avoid useless string allocations
7056e2aa18647319eb5a5e4cce34ed2d3d3553d7
<ide><path>actionpack/lib/abstract_controller/rendering.rb <ide> def _process_format(format) <ide> end <ide> <ide> def _get_content_type(rendered_format) # :nodoc: <del> rendered_format.to_s <ide> end <ide> <ide> def _set_content_type(type) # :nodoc: <ide><path>actionpack/lib/action_controller/metal/rendering.rb <ide> def _render_in_priorities(options) <ide> end <ide> <ide> def _get_content_type(rendered_format) <del> self.content_type || super <add> self.content_type || rendered_format.to_s <ide> end <ide> <ide> def _set_content_type(format)
2
Javascript
Javascript
move immediates to react batchedupdates
4c74f01b85cb26a23292c44118ad1e28f43deaa3
<ide><path>Libraries/Utilities/MessageQueue.js <ide> class MessageQueue { <ide> '__callFunction' : '__invokeCallback'; <ide> guard(() => this[method].apply(this, call.args)); <ide> }); <del> BridgeProfiling.profile('ReactUpdates.batchedUpdates()'); <add> <add> this.__callImmediates(); <ide> }); <del> BridgeProfiling.profileEnd(); <add> <add> // batchedUpdates might still trigger setImmediates <add> while (JSTimersExecution.immediates.length) { <add> ReactUpdates.batchedUpdates(() => { <add> this.__callImmediates(); <add> }); <add> } <ide> }); <del> return this.flushedQueue(); <add> <add> return this.__flushedQueue(); <ide> } <ide> <ide> callFunctionReturnFlushedQueue(module, method, args) { <ide> class MessageQueue { <ide> } <ide> <ide> flushedQueue() { <add> this.__callImmediates(); <add> return this.__flushedQueue(); <add> } <add> <add> /** <add> * "Private" methods <add> */ <add> <add> __callImmediates() { <ide> BridgeProfiling.profile('JSTimersExecution.callImmediates()'); <ide> guard(() => JSTimersExecution.callImmediates()); <ide> BridgeProfiling.profileEnd(); <add> } <add> <add> __flushedQueue() { <ide> let queue = this._queue; <ide> this._queue = [[],[],[]]; <ide> return queue[0].length ? queue : null; <ide> } <del> <del> /** <del> * "Private" methods <del> */ <ide> __nativeCall(module, method, params, onFail, onSucc) { <ide> if (onFail || onSucc) { <ide> // eventually delete old debug info
1
Javascript
Javascript
remove css-sourcemap's when bundling for dist
93c3dc54b66166fd5df7d081a9b2c2ca76a2af00
<ide><path>packages/react-devtools-inline/webpack.config.js <ide> module.exports = { <ide> { <ide> loader: 'css-loader', <ide> options: { <del> sourceMap: true, <add> sourceMap: __DEV__, <ide> modules: true, <ide> localIdentName: '[local]___[hash:base64:5]', <ide> },
1
Ruby
Ruby
move nil config_or_env handling
0946cb929c30ee4cf6460a401f4229f2147d3fdb
<ide><path>activerecord/lib/active_record/connection_handling.rb <ide> module ConnectionHandling <ide> # The exceptions AdapterNotSpecified, AdapterNotFound and +ArgumentError+ <ide> # may be returned on an error. <ide> def establish_connection(config_or_env = nil) <add> config_or_env ||= DEFAULT_ENV.call.to_sym <ide> db_config = resolve_config_for_connection(config_or_env) <ide> connection_handler.establish_connection(db_config, current_pool_key) <ide> end <ide> def clear_cache! # :nodoc: <ide> def resolve_config_for_connection(config_or_env) <ide> raise "Anonymous class is not allowed." unless name <ide> <del> config_or_env ||= DEFAULT_ENV.call.to_sym <ide> pool_name = primary_class? ? Base.name : name <ide> self.connection_specification_name = pool_name <ide>
1
Python
Python
replace input args by set and get method
0a0be7bbd7b3d555c77b6af1d50ebd84ad34b388
<ide><path>glances/core/glances_stats.py <ide> def update(self): <ide> <ide> # For each plugins, call the update method <ide> for p in self._plugins: <add> # Set the input method to SNMP <add> self._plugins[p].set_input('snmp') <ide> # print "DEBUG: Update %s stats using SNMP request" % p <ide> try: <del> self._plugins[p].update(input='snmp') <add> self._plugins[p].update() <ide> except Exception as e: <ide> print "ERROR: Update %s failed (%s)" % (p, e) <ide> # pass <ide><path>glances/plugins/glances_alert.py <ide> def reset(self): <ide> """ <ide> self.stats = [] <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Nothing to do here <ide> Just return the global glances_log <ide><path>glances/plugins/glances_batpercent.py <ide> def reset(self): <ide> """ <ide> self.stats = [] <ide> <del> def update(self, input='local'): <add> def update(self): <ide> <ide> """ <ide> Update batterie capacity stats using the input method <del> Input method could be: local (mandatory) or snmp (optionnal) <ide> """ <ide> <ide> # Reset stats <ide> self.reset() <ide> <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # Update stats using the standard system lib <ide> <ide> self.stats = self.glancesgrabbat.getcapacitypercent() <ide> <del> elif input == 'snmp': <add> elif self.get_input() == 'snmp': <ide> # Update stats using SNMP <ide> # Not avalaible <ide> pass <ide><path>glances/plugins/glances_core.py <ide> def reset(self): <ide> """ <ide> self.stats = {} <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update core stats <del> Input method could be: local (mandatory) or snmp (optionnal) <ide> Stats is a dict (with both physical and log cpu number) instead of a integer <ide> """ <ide> <ide> # Reset the stats <ide> self.reset() <ide> <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # Update stats using the standard system lib <ide> <ide> # The PSUtil 2.0 include psutil.cpu_count() and psutil.cpu_count(logical=False) <ide> def update(self, input='local'): <ide> except NameError: <ide> self.reset() <ide> <del> elif input == 'snmp': <add> elif self.get_input() == 'snmp': <ide> # Update stats using SNMP <ide> # http://stackoverflow.com/questions/5662467/how-to-find-out-the-number-of-cpus-using-snmp <ide> pass <ide><path>glances/plugins/glances_cpu.py <ide> def reset(self): <ide> """ <ide> self.stats = {} <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update CPU stats using the input method <del> Input method could be: local (mandatory) or snmp (optionnal) <ide> """ <ide> <ide> # Reset stats <ide> self.reset() <ide> <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # Update stats using the standard system lib <ide> <ide> # Grab CPU using the PSUtil cpu_times_percent method <ide> def update(self, input='local'): <ide> 'guest', 'guest_nice']: <ide> if hasattr(cputimespercent, cpu): <ide> self.stats[cpu] = getattr(cputimespercent, cpu) <del> elif input == 'snmp': <add> elif self.get_input() == 'snmp': <ide> # Update stats using SNMP <ide> self.stats = self.set_stats_snmp(snmp_oid=snmp_oid) <ide> <ide><path>glances/plugins/glances_diskio.py <ide> def reset(self): <ide> """ <ide> self.stats = [] <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update disk IO stats using the input method <del> Input method could be: local (mandatory) or snmp (optionnal) <ide> """ <ide> <ide> # Reset stats <ide> self.reset() <ide> <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # Update stats using the standard system lib <ide> # Grab the stat using the PsUtil disk_io_counters method <ide> # read_count: number of reads <ide> def update(self, input='local'): <ide> <ide> # Save stats to compute next bitrate <ide> self.diskio_old = diskio_new <del> elif input == 'snmp': <add> elif self.get_input() == 'snmp': <ide> # Update stats using SNMP <ide> # !!! TODO: no standard way for the moment <ide> pass <ide><path>glances/plugins/glances_fs.py <ide> def reset(self): <ide> """ <ide> self.stats = [] <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update the FS stats using the input method <del> Input method could be: local (mandatory) or snmp (optionnal) <ide> """ <ide> <ide> # Reset the list <ide> self.reset() <ide> <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # Update stats using the standard system lib <ide> <ide> # Grab the stats using the PsUtil disk_partitions <ide> def update(self, input='local'): <ide> fs_current['percent'] = fs_usage.percent <ide> self.stats.append(fs_current) <ide> <del> elif input == 'snmp': <add> elif self.get_input() == 'snmp': <ide> # Update stats using SNMP <ide> <ide> # SNMP bulk command to get all file system in one shot <ide><path>glances/plugins/glances_hddtemp.py <ide> def reset(self): <ide> """ <ide> self.stats = [] <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update HDD stats using the input method <del> Input method could be: local (mandatory) or snmp (optionnal) <ide> """ <ide> <ide> # Reset stats <ide> self.reset() <ide> <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # Update stats using the standard system lib <ide> self.stats = self.glancesgrabhddtemp.get() <ide> <del> elif input == 'snmp': <add> else: <ide> # Update stats using SNMP <ide> # Not available for the moment <ide> pass <ide><path>glances/plugins/glances_help.py <ide> def __init__(self, args=None): <ide> # Enter -1 to diplay bottom <ide> self.line_curse = 0 <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> No stats, it is just a plugin to display the help... <ide> """ <ide><path>glances/plugins/glances_load.py <ide> def reset(self): <ide> """ <ide> self.stats = {} <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update load stats using the input method <del> Input method could be: local (mandatory) or snmp (optionnal) <ide> """ <ide> <ide> # Reset stats <ide> def update(self, input='local'): <ide> except: <ide> nb_log_core = 0 <ide> <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # Update stats using the standard system lib <ide> <ide> # Get the load using the os standard lib <ide> def update(self, input='local'): <ide> 'min5': load[1], <ide> 'min15': load[2], <ide> 'cpucore': nb_log_core } <del> elif input == 'snmp': <add> elif self.get_input() == 'snmp': <ide> # Update stats using SNMP <ide> self.stats = self.set_stats_snmp(snmp_oid=snmp_oid) <ide> <ide><path>glances/plugins/glances_mem.py <ide> def reset(self): <ide> """ <ide> self.stats = {} <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update MEM (RAM) stats using the input method <del> Input method could be: local (mandatory) or snmp (optionnal) <ide> """ <ide> <ide> # Reset stats <ide> self.reset() <ide> <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # Update stats using the standard system lib <ide> # Grab MEM using the PSUtil virtual_memory method <ide> vm_stats = psutil.virtual_memory() <ide> def update(self, input='local'): <ide> self.stats['free'] += self.stats['cached'] <ide> # used=total-free <ide> self.stats['used'] = self.stats['total'] - self.stats['free'] <del> elif input == 'snmp': <add> elif self.get_input() == 'snmp': <ide> # Update stats using SNMP <ide> self.stats = self.set_stats_snmp(snmp_oid=snmp_oid) <ide> <ide><path>glances/plugins/glances_memswap.py <ide> def reset(self): <ide> """ <ide> self.stats = {} <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update MEM (SWAP) stats using the input method <del> Input method could be: local (mandatory) or snmp (optionnal) <ide> """ <ide> <ide> # Reset stats <ide> self.reset() <ide> <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # Update stats using the standard system lib <ide> # Grab SWAP using the PSUtil swap_memory method <ide> sm_stats = psutil.swap_memory() <ide> def update(self, input='local'): <ide> 'sin', 'sout']: <ide> if hasattr(sm_stats, swap): <ide> self.stats[swap] = getattr(sm_stats, swap) <del> elif input == 'snmp': <add> elif self.get_input() == 'snmp': <ide> # Update stats using SNMP <ide> self.stats = self.set_stats_snmp(snmp_oid=snmp_oid) <ide> <ide><path>glances/plugins/glances_monitor.py <ide> def load_limits(self, config): <ide> # print "DEBUG: Monitor plugin load config file %s" % config <ide> self.glances_monitors = glancesMonitorList(config) <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update the monitored list <ide> """ <ide> <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # Monitor list only available in a full Glances environment <ide> # Check if the glances_monitor instance is init <ide> if self.glances_monitors is None: <ide><path>glances/plugins/glances_network.py <ide> def reset(self): <ide> """ <ide> self.stats = [] <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update network stats using the input method <del> Input method could be: local (mandatory) or snmp (optionnal) <ide> Stats is a list of dict (one dict per interface) <ide> """ <ide> <ide> # Reset stats <ide> self.reset() <ide> <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # Update stats using the standard system lib <ide> <ide> # Grab network interface stat using the PsUtil net_io_counter method <ide> def update(self, input='local'): <ide> # Save stats to compute next bitrate <ide> self.network_old = network_new <ide> <del> elif input == 'snmp': <add> elif self.get_input() == 'snmp': <ide> # Update stats using SNMP <ide> <ide> <ide><path>glances/plugins/glances_now.py <ide> def __init__(self, args=None): <ide> # Enter -1 to diplay bottom <ide> self.line_curse = -1 <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update current date/time <ide> """ <ide><path>glances/plugins/glances_percpu.py <ide> def reset(self): <ide> """ <ide> self.stats = [] <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update Per CPU stats using the input method <del> Input method could be: local (mandatory) or snmp (optionnal) <ide> """ <ide> <ide> # Reset stats <ide> self.reset() <ide> <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # Update stats using the standard system lib <ide> <ide> # Grab CPU using the PSUtil cpu_times method <ide> def update(self, input='local'): <ide> except Exception: <ide> self.reset() <ide> <del> elif input == 'snmp': <add> else: <ide> # Update stats using SNMP <ide> pass <ide> <ide><path>glances/plugins/glances_plugin.py <ide> def __init__(self, args=None): <ide> # Init the args <ide> self.args = args <ide> <add> # Init the input method <add> self.input = 'local' <add> <ide> # Init the stats list <ide> self.stats = None <ide> <ide> def __str__(self): <ide> # Return the human-readable stats <ide> return str(self.stats) <ide> <add> def set_input(self, input): <add> """ <add> Set the input method: <add> * local: system local grab (PSUtil or direct access) <add> * snmp: Client server mode via SNMP <add> * glances: Client server mode via Glances API <add> """ <add> self.input = input <add> <add> def get_input(self): <add> """ <add> Get the input method <add> """ <add> return self.input <add> <ide> def set_stats(self, input_stats): <ide> # Set the stats to input_stats <ide> self.stats = input_stats <ide><path>glances/plugins/glances_processcount.py <ide> def reset(self): <ide> """ <ide> self.stats = {} <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update processes stats using the input method <del> Input method could be: local (mandatory) or snmp (optionnal) <ide> """ <ide> <ide> # Reset stats <ide> self.reset() <ide> <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # Update stats using the standard system lib <ide> # Here, update is call for processcount AND processlist <ide> glances_processes.update() <ide> <ide> # Return the processes count <ide> self.stats = glances_processes.getcount() <del> elif input == 'snmp': <add> elif self.get_input() == 'snmp': <ide> # Update stats using SNMP <ide> # !!! TODO <ide> pass <ide><path>glances/plugins/glances_processlist.py <ide> def reset(self): <ide> """ <ide> self.stats = [] <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update processes stats using the input method <del> Input method could be: local (mandatory) or snmp (optionnal) <ide> """ <ide> <ide> # Reset stats <ide> self.reset() <ide> <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # Update stats using the standard system lib <ide> # Note: Update is done in the processcount plugin <ide> # Just return the processes list <ide> self.stats = glances_processes.getlist() <del> elif input == 'snmp': <add> elif self.get_input() == 'snmp': <ide> # Update stats using SNMP <ide> # !!! TODO <ide> pass <ide><path>glances/plugins/glances_psutilversion.py <ide> def reset(self): <ide> """ <ide> self.stats = None <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update core stats <ide> """ <ide> def update(self, input='local'): <ide> self.reset() <ide> <ide> # Return PsUtil version as a tuple <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # PsUtil version only available in local <ide> try: <ide> self.stats = tuple([int(num) for num in __psutil_version__.split('.')]) <ide><path>glances/plugins/glances_sensors.py <ide> def reset(self): <ide> """ <ide> self.stats = [] <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update sensors stats using the input method <del> Input method could be: local (mandatory) or snmp (optionnal) <ide> """ <ide> <ide> # Reset the stats <ide> self.reset() <ide> <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # Update stats using the standard system lib <ide> self.hddtemp_plugin.update() <ide> self.stats = self.glancesgrabsensors.get() <ide> self.stats.extend(self.hddtemp_plugin.stats) <del> elif input == 'snmp': <add> elif self.get_input() == 'snmp': <ide> # Update stats using SNMP <ide> # No standard: http://www.net-snmp.org/wiki/index.php/Net-SNMP_and_lm-sensors_on_Ubuntu_10.04 <ide> pass <ide><path>glances/plugins/glances_system.py <ide> def reset(self): <ide> """ <ide> self.stats = {} <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update the host/system info using the input method <del> Input method could be: local (mandatory) or snmp (optionnal) <ide> Return the stats (dict) <ide> """ <ide> <ide> # Reset stats <ide> self.reset() <ide> <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # Update stats using the standard system lib <ide> self.stats['os_name'] = platform.system() <ide> self.stats['hostname'] = platform.node() <ide> def update(self, input='local'): <ide> self.stats['os_version'] = ' '.join(os_version[::2]) <ide> else: <ide> self.stats['os_version'] = "" <del> elif input == 'snmp': <add> elif self.get_input() == 'snmp': <ide> # Update stats using SNMP <ide> self.stats = self.set_stats_snmp(snmp_oid=snmp_oid) <ide> <ide><path>glances/plugins/glances_uptime.py <ide> def reset(self): <ide> """ <ide> self.stats = {} <ide> <del> def update(self, input='local'): <add> def update(self): <ide> """ <ide> Update uptime stat using the input method <del> Input method could be: local (mandatory) or snmp (optionnal) <ide> """ <ide> <ide> # Reset stats <ide> self.reset() <ide> <del> if input == 'local': <add> if self.get_input() == 'local': <ide> # Update stats using the standard system lib <ide> uptime = datetime.now() - datetime.fromtimestamp(psutil.boot_time()) <ide> <ide> # Convert uptime to string (because datetime is not JSONifi) <ide> self.stats = str(uptime).split('.')[0] <del> elif input == 'snmp': <add> elif self.get_input() == 'snmp': <ide> # Update stats using SNMP <ide> uptime = self.set_stats_snmp(snmp_oid=snmp_oid)['_uptime'] <ide> try:
23
Java
Java
fix broken javadoc link to rome tools project
19aceebb961bd7fe24477a8e15830c668f519385
<ide><path>spring-web/src/main/java/org/springframework/http/converter/feed/AbstractWireFeedHttpMessageConverter.java <ide> /* <del> * Copyright 2002-2010 the original author or authors. <add> * Copyright 2002-2012 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import org.springframework.util.StringUtils; <ide> <ide> /** <del> * Abstract base class for Atom and RSS Feed message converters, using java.net's <del> * <a href="https://rome.dev.java.net/">ROME</a> package. <add> * Abstract base class for Atom and RSS Feed message converters, using the <add> * <a href="http://rometools.org/">ROME tools</a> project. <ide> * <ide> * @author Arjen Poutsma <ide> * @since 3.0.2
1
Javascript
Javascript
add test for readstream.path when fd is specified
eafdeab97b6757485781f19b90786a87b2b36369
<ide><path>test/parallel/test-fs-read-stream-fd.js <ide> fs.writeFileSync(file, input); <ide> const fd = fs.openSync(file, 'r'); <ide> const stream = fs.createReadStream(null, { fd: fd, encoding: 'utf8' }); <ide> <add>assert.strictEqual(stream.path, undefined); <add> <ide> stream.on('data', common.mustCallAtLeast((data) => { <ide> output += data; <ide> }));
1
Javascript
Javascript
add spec for imageeditor
d2ef1145382b63d95f1f3374384e55487adee130
<ide><path>Libraries/Image/ImageEditor.js <ide> * @format <ide> */ <ide> 'use strict'; <del> <del>const RCTImageEditingManager = require('../BatchedBridge/NativeModules') <del> .ImageEditingManager; <add>import NativeImageEditor from './NativeImageEditor'; <ide> <ide> type ImageCropData = { <ide> /** <ide> class ImageEditor { <ide> success: (uri: string) => void, <ide> failure: (error: Object) => void, <ide> ) { <del> RCTImageEditingManager.cropImage(uri, cropData, success, failure); <add> NativeImageEditor.cropImage(uri, cropData, success, failure); <ide> } <ide> } <ide> <ide><path>Libraries/Image/NativeImageEditor.js <add>/** <add> * Copyright (c) Facebook, Inc. and its affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @flow <add> * @format <add> */ <add> <add>'use strict'; <add> <add>import type {TurboModule} from 'RCTExport'; <add>import * as TurboModuleRegistry from 'TurboModuleRegistry'; <add> <add>export interface Spec extends TurboModule { <add> +cropImage: ( <add> uri: string, <add> options: Object, // TODO: type this better <add> success: (uri: string) => void, <add> error: (error: string) => void, <add> ) => void; <add>} <add> <add>export default TurboModuleRegistry.getEnforcing<Spec>('ImageEditingManager');
2
Javascript
Javascript
implement review feedback
e1ea0a717c1db11e0e079b27e7d536faccad14e7
<ide><path>lib/optimize/CommonsChunkPlugin.js <ide> The available options are: <ide> this.children = normalizedOptions.children; <ide> this.async = normalizedOptions.async; <ide> this.minSize = normalizedOptions.minSize; <del> this.ident = normalizedOptions.ident; <add> this.ident = __filename + (nextIdent++); <ide> } <ide> <ide> normalizeOptions(options) { <ide> You can however specify the name of the async chunk by passing the desired strin <ide> selectedChunks: options.chunks, <ide> children: options.children, <ide> async: options.async, <del> minSize: options.minSize, <del> ident: __filename + (nextIdent++), <add> minSize: options.minSize <ide> }; <ide> } <ide> <ide> apply(compiler) { <del> const filenameTemplate = this.filenameTemplate; <del> const asyncOption = this.async; <del> const minSize = this.minSize; <del> const minChunks = this.minChunks; <del> const ident = this.ident; <ide> compiler.plugin("this-compilation", (compilation) => { <ide> compilation.plugin(["optimize-chunks", "optimize-extracted-chunks"], (chunks) => { <ide> // only optimize once <del> if(compilation[ident]) return; <del> compilation[ident] = true; <add> if(compilation[this.ident]) return; <add> compilation[this.ident] = true; <ide> <ide> /** <ide> * Creates a list of "common"" chunks based on the options. <ide> You can however specify the name of the async chunk by passing the desired strin <ide> // If we are async create an async chunk now <ide> // override the "commonChunk" with the newly created async one and use it as commonChunk from now on <ide> let asyncChunk; <del> if(asyncOption) { <add> if(this.async) { <ide> asyncChunk = this.createAsyncChunk(compilation, this.async, targetChunk); <del> targetChunk.addChunk(asyncChunk); <ide> targetChunk = asyncChunk; <ide> } <ide> <ide> /** <ide> * Check which modules are "common" and could be extracted to a "common" chunk <ide> */ <del> const extractableModules = this.getExtractableModules(minChunks, affectedChunks, targetChunk); <add> const extractableModules = this.getExtractableModules(this.minChunks, affectedChunks, targetChunk); <ide> <ide> // If the minSize option is set check if the size extracted from the chunk is reached <ide> // else bail out here. <ide> // As all modules/commons are interlinked with each other, common modules would be extracted <ide> // if we reach this mark at a later common chunk. (quirky I guess). <del> if(minSize) { <del> const modulesSize = this.calculateModuleSize(extractableModules); <add> if(this.minSize) { <add> const modulesSize = this.calculateModulesSize(extractableModules); <ide> // if too small, bail <del> if(modulesSize < minSize) <add> if(modulesSize < this.minSize) <ide> return; <ide> } <ide> <ide> You can however specify the name of the async chunk by passing the desired strin <ide> this.addExtractedModulesToTargetChunk(targetChunk, extractableModules); <ide> <ide> // set filenameTemplate for chunk <del> if(filenameTemplate) <del> targetChunk.filenameTemplate = filenameTemplate; <add> if(this.filenameTemplate) <add> targetChunk.filenameTemplate = this.filenameTemplate; <ide> <ide> // if we are async connect the blocks of the "reallyUsedChunk" - the ones that had modules removed - <ide> // with the commonChunk and get the origins for the asyncChunk (remember "asyncChunk === commonChunk" at this moment). <ide> // bail out <del> if(asyncOption) { <add> if(this.async) { <ide> this.moveExtractedChunkBlocksToTargetChunk(chunksWithExtractedModules, targetChunk); <ide> asyncChunk.origins = this.extractOriginsOfChunksWithExtractedModules(chunksWithExtractedModules); <ide> return; <ide> You can however specify the name of the async chunk by passing the desired strin <ide> return allChunks; <ide> } <ide> <del> // that is not supposed to happen, lets throw <del> throw new Error("Invalid chunkNames argument"); <add> /** <add> * No chunk name(s) was specified nor is this an async/children commons chunk <add> */ <add> throw new Error(`You did not specify any valid target chunk settings. <add>Take a look at the "name"/"names" or async/children option.`); <ide> } <ide> <ide> getAffectedChunks(compilation, allChunks, targetChunk, targetChunks, currentIndex, selectedChunks, asyncOption, children) { <ide> You can however specify the name of the async chunk by passing the desired strin <ide> asyncChunk.chunkReason = "async commons chunk"; <ide> asyncChunk.extraAsync = true; <ide> asyncChunk.addParent(targetChunk); <add> targetChunk.addChunk(asyncChunk); <ide> return asyncChunk; <ide> } <ide> <ide> You can however specify the name of the async chunk by passing the desired strin <ide> // count how many chunks contain a module <ide> const commonModulesToCountMap = usedChunks.reduce((map, chunk) => { <ide> for(let module of chunk.modules) { <del> let count = map.has(module) ? map.get(module) : 0; <add> const count = map.has(module) ? map.get(module) : 0; <ide> map.set(module, count + 1); <ide> } <ide> return map; <ide> You can however specify the name of the async chunk by passing the desired strin <ide> }).map(entry => entry[0]); <ide> } <ide> <del> calculateModuleSize(modules) { <del> return modules.reduce((count, module) => count + module.size(), 0); <add> calculateModulesSize(modules) { <add> return modules.reduce((totalSize, module) => totalSize + module.size(), 0); <ide> } <ide> <ide> extractModulesAndReturnAffectedChunks(reallyUsedModules, usedChunks) { <ide> You can however specify the name of the async chunk by passing the desired strin <ide> } <ide> } <ide> <del> moveExtractedChunkBlocksToTargetChunk(chunks, commonChunk) { <add> moveExtractedChunkBlocksToTargetChunk(chunks, targetChunk) { <ide> for(let chunk of chunks) { <ide> // only for non initial chunks <ide> // TODO: why? <ide> if(!chunk.isInitial()) { <ide> for(let block of chunk.blocks) { <del> block.chunks.unshift(commonChunk); <del> commonChunk.addBlock(block); <add> block.chunks.unshift(targetChunk); <add> targetChunk.addBlock(block); <ide> } <ide> } <ide> }
1
PHP
PHP
fix foreach error when usetable = false
08cde9f5a2dec46422db058e682ca4e872aae71b
<ide><path>lib/Cake/Model/Model.php <ide> public function schema($field = false) { <ide> if ($this->useTable !== false && (!is_array($this->_schema) || $field === true)) { <ide> $db = $this->getDataSource(); <ide> $db->cacheSources = ($this->cacheSources && $db->cacheSources); <del> if (method_exists($db, 'describe') && $this->useTable !== false) { <add> if (method_exists($db, 'describe')) { <ide> $this->_schema = $db->describe($this); <del> } elseif ($this->useTable === false) { <del> $this->_schema = array(); <ide> } <ide> } <ide> if (is_string($field)) { <ide> public function create($data = array(), $filterKey = false) { <ide> $this->validationErrors = array(); <ide> <ide> if ($data !== null && $data !== false) { <del> foreach ($this->schema() as $field => $properties) { <add> $schema = (array)$this->schema(); <add> foreach ($schema as $field => $properties) { <ide> if ($this->primaryKey !== $field && isset($properties['default']) && $properties['default'] !== '') { <ide> $defaults[$field] = $properties['default']; <ide> } <ide><path>lib/Cake/Test/Case/Model/ModelIntegrationTest.php <ide> public function testSchema() { <ide> $this->assertEquals($Post->getColumnTypes(), array_combine($columns, $types)); <ide> } <ide> <add>/** <add> * Check schema() on a model with useTable = false; <add> * <add> * @return void <add> */ <add> public function testSchemaUseTableFalse() { <add> $model = new TheVoid(); <add> $result = $model->schema(); <add> $this->assertNull($result); <add> <add> $result = $model->create(); <add> $this->assertEmpty($result); <add> } <add> <ide> /** <ide> * data provider for time tests. <ide> *
2
Java
Java
remove replaceokhttpclient method
7cbdd7b6ac7db2192f7d0193d22326041517a63e
<ide><path>ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientProvider.java <ide> public static OkHttpClient getOkHttpClient() { <ide> } <ide> return sClient; <ide> } <del> <del> // okhttp3 OkHttpClient is immutable <del> // This allows app to init an OkHttpClient with custom settings. <del> public static void replaceOkHttpClient(OkHttpClient client) { <del> sClient = client; <del> } <ide> <ide> public static OkHttpClient createClient() { <ide> if (sFactory != null) {
1
PHP
PHP
explain unusual parent call
8a41e8467893a6604303d240d6e30bc6c9c5f9c9
<ide><path>src/ORM/Query.php <ide> public function delete($table = null) <ide> $repository = $this->getRepository(); <ide> $this->from([$repository->getAlias() => $repository->getTable()]); <ide> <add> // We do not pass $table to parent class here <ide> return parent::delete(); <ide> } <ide>
1
Python
Python
fix secure propagation issue
1e5945f8b04a1d123a89c87e855b7e38fcb45a1a
<ide><path>libcloud/common/base.py <ide> def connect(self, host=None, port=None, base_url=None, **kwargs): <ide> if not hasattr(kwargs, 'port'): <ide> kwargs.update({'port': port}) <ide> <add> if not hasattr(kwargs, 'secure'): <add> kwargs.update({'secure': self.secure}) <add> <ide> if not hasattr(kwargs, 'key_file') and hasattr(self, 'key_file'): <ide> kwargs.update({'key_file': getattr(self, 'key_file')}) <ide> <ide><path>libcloud/httplib_ssl.py <ide> class LibcloudConnection(LibcloudBaseConnection): <ide> host = None <ide> response = None <ide> <del> def __init__(self, host, port, **kwargs): <add> def __init__(self, host, port, secure=None, **kwargs): <add> scheme = 'https' if secure is not None and secure else 'http' <ide> self.host = '{0}://{1}{2}'.format( <del> 'https' if port == 443 else 'http', <add> 'https' if port == 443 else scheme, <ide> host, <ide> ":{0}".format(port) if port not in (80, 443) else "" <ide> )
2
PHP
PHP
choice
061a24a2c1b1898bf39997bade3105867c848f7f
<ide><path>src/Illuminate/Translation/Translator.php <ide> protected function sortReplacements(array $replace) <ide> */ <ide> public function choice($key, $number, array $replace = array(), $locale = null) <ide> { <del> $line = $this->get($key, $replace, $locale = $locale ?: $this->locale); <add> $line = $this->get($key, $replace, $locale = $locale ?: $this->locale ?: $this->fallback); <ide> <ide> $replace['count'] = $number; <ide>
1
Ruby
Ruby
use existing support for previous types
0ee7f4a5f1bbb578f04bb75728cf0c16b87b28ac
<ide><path>activerecord/lib/active_record/encryption/encryptable_record.rb <ide> module EncryptableRecord <ide> <ide> included do <ide> class_attribute :encrypted_attributes <del> class_attribute :_deterministic_encrypted_attributes # For memoization, we want to let each child keep its own <ide> <ide> validate :cant_modify_encrypted_attributes_when_frozen, if: -> { has_encrypted_attributes? && ActiveRecord::Encryption.context.frozen_encryption? } <ide> end <ide> module EncryptableRecord <ide> def encrypts(*names, key_provider: nil, key: nil, deterministic: false, downcase: false, ignore_case: false, previous: [], **context_properties) <ide> self.encrypted_attributes ||= Set.new # not using :default because the instance would be shared across classes <ide> <del> if table_exists? <del> names.each do |name| <del> encrypt_attribute name, key_provider: key_provider, key: key, deterministic: deterministic, downcase: downcase, <del> ignore_case: ignore_case, subtype: type_for_attribute(name), previous: previous, **context_properties <del> end <add> names.each do |name| <add> encrypt_attribute name, key_provider: key_provider, key: key, deterministic: deterministic, downcase: downcase, <add> ignore_case: ignore_case, previous: previous, **context_properties <ide> end <ide> end <ide> <ide> # Returns the list of deterministic encryptable attributes in the model class. <ide> def deterministic_encrypted_attributes <del> self._deterministic_encrypted_attributes ||= encrypted_attributes&.find_all do |attribute_name| <add> @deterministic_encrypted_attributes ||= encrypted_attributes&.find_all do |attribute_name| <ide> type_for_attribute(attribute_name).deterministic? <ide> end <ide> end <ide> def source_attribute_from_preserved_attribute(attribute_name) <ide> <ide> private <ide> def encrypt_attribute(name, key_provider: nil, key: nil, deterministic: false, downcase: false, <del> ignore_case: false, subtype: ActiveModel::Type::String.new, previous: [], **context_properties) <add> ignore_case: false, previous: [], **context_properties) <ide> raise Errors::Configuration, ":ignore_case can only be used with deterministic encryption" if ignore_case && !deterministic <ide> raise Errors::Configuration, ":key_provider and :key can't be used simultaneously" if key_provider && key <ide> <ide> encrypted_attributes << name.to_sym <ide> <ide> key_provider = build_key_provider(key_provider: key_provider, key: key, deterministic: deterministic) <ide> <del> attribute name, :encrypted, key_provider: key_provider, downcase: downcase || ignore_case, deterministic: deterministic, <del> subtype: subtype, previous_types: build_previous_types(previous, subtype), **context_properties <add> attribute name do |cast_type| <add> ActiveRecord::Encryption::EncryptedAttributeType.new \ <add> key_provider: key_provider, downcase: downcase || ignore_case, deterministic: deterministic, <add> cast_type: cast_type, previous_types: build_previous_types(previous), **context_properties <add> end <ide> <ide> preserve_original_encrypted(name) if ignore_case <ide> validate_column_size(name) if ActiveRecord::Encryption.config.validate_column_size <ide> ActiveRecord::Encryption.encrypted_attribute_was_declared(self, name) <ide> end <ide> <del> def build_previous_types(previous_config_list, type) <add> def build_previous_types(previous_config_list) <ide> previous_config_list = [previous_config_list] unless previous_config_list.is_a?(Array) <ide> previous_config_list.collect do |previous_config| <ide> key_provider = build_key_provider(**previous_config.slice(:key_provider, :key, :deterministic)) <ide> context_properties = previous_config.slice(*ActiveRecord::Encryption::Context::PROPERTIES.without(:key_provider)) <ide> ActiveRecord::Encryption::EncryptedAttributeType.new \ <del> key_provider: key_provider, downcase: previous_config[:downcase] || previous_config[:ignore_case], <del> deterministic: previous_config[:deterministic], subtype: type, **context_properties <add> key_provider: key_provider, downcase: previous_config[:downcase] || previous_config[:ignore_case], <add> deterministic: previous_config[:deterministic], **context_properties <ide> end <ide> end <ide> <ide> def preserve_original_encrypted(name) <ide> self.send "#{original_attribute_name}=", value <ide> super(value) <ide> end <del> end <add> end <ide> <ide> def validate_column_size(attribute_name) <del> if limit = connection.schema_cache.columns_hash(table_name)[attribute_name.to_s]&.limit <add> if table_exists? && limit = connection.schema_cache.columns_hash(table_name)[attribute_name.to_s]&.limit <ide> validates_length_of attribute_name, maximum: limit <ide> end <ide> end <ide><path>activerecord/lib/active_record/encryption/encrypted_attribute_type.rb <ide> module Encryption <ide> class EncryptedAttributeType < ::ActiveRecord::Type::Text <ide> include ActiveModel::Type::Helpers::Mutable <ide> <del> attr_reader :key_provider, :previous_types, :subtype, :downcase <add> attr_reader :key_provider, :previous_types, :cast_type, :downcase <ide> <del> def initialize(key_provider: nil, deterministic: false, downcase: false, subtype: ActiveModel::Type::String.new, previous_types: [], **context_properties) <add> def initialize(key_provider: nil, deterministic: false, downcase: false, cast_type: ActiveModel::Type::String.new, previous_types: [], **context_properties) <ide> super() <ide> @key_provider = key_provider <ide> @deterministic = deterministic <ide> @downcase = downcase <del> @subtype = subtype <add> @cast_type = cast_type <ide> @previous_types = previous_types <ide> @context_properties = context_properties <ide> end <ide> <ide> def deserialize(value) <del> @subtype.deserialize decrypt(value) <add> @cast_type.deserialize decrypt(value) <ide> end <ide> <ide> def serialize(value) <del> casted_value = @subtype.serialize(value) <add> casted_value = @cast_type.serialize(value) <ide> casted_value = casted_value&.downcase if @downcase <ide> encrypt(casted_value.to_s) unless casted_value.nil? # Object values without a proper serializer get converted with #to_s <ide> end
2
Python
Python
add region to snowflake uri.
0a37be3e3cf9289f63f1506bc31db409c2b46738
<ide><path>airflow/providers/snowflake/hooks/snowflake.py <ide> def get_uri(self) -> str: <ide> """Override DbApiHook get_uri method for get_sqlalchemy_engine()""" <ide> conn_config = self._get_conn_params() <ide> uri = ( <del> 'snowflake://{user}:{password}@{account}/{database}/{schema}' <add> 'snowflake://{user}:{password}@{account}.{region}/{database}/{schema}' <ide> '?warehouse={warehouse}&role={role}&authenticator={authenticator}' <ide> ) <ide> return uri.format(**conn_config) <ide><path>tests/providers/snowflake/hooks/test_snowflake.py <ide> def tearDown(self): <ide> <ide> def test_get_uri(self): <ide> uri_shouldbe = ( <del> 'snowflake://user:pw@airflow/db/public?warehouse=af_wh&role=af_role&authenticator=snowflake' <add> 'snowflake://user:[email protected]_region/db/public?' <add> 'warehouse=af_wh&role=af_role&authenticator=snowflake' <ide> ) <ide> assert uri_shouldbe == self.db_hook.get_uri() <ide> <ide> def tearDownExtra(self): <ide> <ide> def test_get_uri_extra(self): <ide> uri_shouldbe = ( <del> 'snowflake://user:pw@airflow/db/public?warehouse=af_wh&role=af_role&authenticator=snowflake' <add> 'snowflake://user:[email protected]_region/db/public?' <add> 'warehouse=af_wh&role=af_role&authenticator=snowflake' <ide> ) <ide> assert uri_shouldbe == self.db_hook_extra.get_uri() <ide>
2
Text
Text
remove wrong remark on readable.read
8987ae843e034745f7247f63928d39f06ed7b116
<ide><path>doc/api/stream.md <ide> in object mode. <ide> The optional `size` argument specifies a specific number of bytes to read. If <ide> `size` bytes are not available to be read, `null` will be returned *unless* <ide> the stream has ended, in which case all of the data remaining in the internal <del>buffer will be returned (*even if it exceeds `size` bytes*). <add>buffer will be returned. <ide> <ide> If the `size` argument is not specified, all of the data contained in the <ide> internal buffer will be returned.
1
Java
Java
restore handling of 0 bytes read
551505bd93003e983fb97bbf30221a45de138178
<ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerReadPublisher.java <ide> <T> void request(AbstractListenerReadPublisher<T> publisher, long n) { <ide> <T> void onDataAvailable(AbstractListenerReadPublisher<T> publisher) { <ide> if (publisher.changeState(this, READING)) { <ide> try { <del> boolean demandAvailable = publisher.readAndPublish(); <add> boolean demandAvailable = publisher. <add> readAndPublish(); <ide> if (demandAvailable) { <ide> publisher.changeToDemandState(READING); <ide> } <ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/ServletServerHttpRequest.java <ide> public Flux<DataBuffer> getBody() { <ide> /** <ide> * Read from the request body InputStream and return a DataBuffer. <ide> * Invoked only when {@link ServletInputStream#isReady()} returns "true". <add> * @return a DataBuffer with data read, or {@link #EOF_BUFFER} if the input <add> * stream returned -1, or null if 0 bytes were read. <ide> */ <ide> @Nullable <ide> DataBuffer readFromInputStream() throws IOException { <ide> DataBuffer readFromInputStream() throws IOException { <ide> dataBuffer.write(this.buffer, 0, read); <ide> return dataBuffer; <ide> } <del> else if (read == -1) { <add> <add> if (read == -1) { <ide> return EOF_BUFFER; <ide> } <ide> <ide> protected void checkOnDataAvailable() { <ide> protected DataBuffer read() throws IOException { <ide> if (this.inputStream.isReady()) { <ide> DataBuffer dataBuffer = readFromInputStream(); <del> if (dataBuffer != EOF_BUFFER) { <del> return dataBuffer; <del> } <del> else { <add> if (dataBuffer == EOF_BUFFER) { <ide> // No need to wait for container callback... <ide> onAllDataRead(); <add> dataBuffer = null; <ide> } <add> return dataBuffer; <ide> } <ide> return null; <ide> }
2
Python
Python
improve error message for bad fk resolution
ade34c44dae4f5cf9d51bf7f900bf06efa98ff12
<ide><path>django/db/models/fields/related.py <ide> def __init__(self, to, from_fields, to_fields, **kwargs): <ide> def resolve_related_fields(self): <ide> if len(self.from_fields) < 1 or len(self.from_fields) != len(self.to_fields): <ide> raise ValueError('Foreign Object from and to fields must be the same non-zero length') <add> if isinstance(self.rel.to, basestring): <add> raise ValueError('Related model %r cannot been resolved' % self.rel.to) <ide> related_fields = [] <ide> for index in range(len(self.from_fields)): <ide> from_field_name = self.from_fields[index]
1
Ruby
Ruby
remove redundant assignning to `current_env`
9ed7c7e9e2d61d60bc40aed421444cddc40d51f8
<ide><path>activerecord/test/cases/migration_test.rb <ide> def test_internal_metadata_stores_environment_when_other_data_exists <ide> current_env = ActiveRecord::ConnectionHandling::DEFAULT_ENV.call <ide> migrations_path = MIGRATIONS_ROOT + "/valid" <ide> <del> current_env = ActiveRecord::ConnectionHandling::DEFAULT_ENV.call <ide> migrator = ActiveRecord::MigrationContext.new(migrations_path) <ide> migrator.up <ide> assert_equal current_env, ActiveRecord::InternalMetadata[:environment]
1
Java
Java
copy cookies and hints in built serverresponse
d8215e7c79d7734da06f724e56d4e6a3d3d04c0d
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultEntityResponseBuilder.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2019 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> public Mono<EntityResponse<T>> build() { <ide> <ide> private final BodyInserter<T, ? super ServerHttpResponse> inserter; <ide> <del> private final Map<String, Object> hints; <ide> <ide> public DefaultEntityResponse(int statusCode, HttpHeaders headers, <ide> MultiValueMap<String, ResponseCookie> cookies, T entity, <ide> BodyInserter<T, ? super ServerHttpResponse> inserter, Map<String, Object> hints) { <ide> <del> super(statusCode, headers, cookies); <add> super(statusCode, headers, cookies, hints); <ide> this.entity = entity; <ide> this.inserter = inserter; <del> this.hints = hints; <ide> } <ide> <ide> @Override <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultRenderingResponseBuilder.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2019 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> private static final class DefaultRenderingResponse extends DefaultServerRespons <ide> public DefaultRenderingResponse(int statusCode, HttpHeaders headers, <ide> MultiValueMap<String, ResponseCookie> cookies, String name, Map<String, Object> model) { <ide> <del> super(statusCode, headers, cookies); <add> super(statusCode, headers, cookies, Collections.emptyMap()); <ide> this.name = name; <ide> this.model = Collections.unmodifiableMap(new LinkedHashMap<>(model)); <ide> } <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilder.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2019 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import java.time.Instant; <ide> import java.time.ZonedDateTime; <ide> import java.util.Arrays; <add>import java.util.Collections; <ide> import java.util.EnumSet; <ide> import java.util.HashMap; <ide> import java.util.LinkedHashSet; <ide> class DefaultServerResponseBuilder implements ServerResponse.BodyBuilder { <ide> <ide> public DefaultServerResponseBuilder(ServerResponse other) { <ide> Assert.notNull(other, "ServerResponse must not be null"); <del> this.statusCode = (other instanceof AbstractServerResponse ? <del> ((AbstractServerResponse) other).statusCode : other.statusCode().value()); <ide> this.headers.addAll(other.headers()); <add> this.cookies.addAll(other.cookies()); <add> if (other instanceof AbstractServerResponse) { <add> AbstractServerResponse abstractOther = (AbstractServerResponse) other; <add> this.statusCode = abstractOther.statusCode; <add> this.hints.putAll(abstractOther.hints); <add> } <add> else { <add> this.statusCode = other.statusCode().value(); <add> } <ide> } <ide> <ide> public DefaultServerResponseBuilder(HttpStatus status) { <ide> abstract static class AbstractServerResponse implements ServerResponse { <ide> <ide> private final MultiValueMap<String, ResponseCookie> cookies; <ide> <add> final Map<String, Object> hints; <add> <add> <ide> protected AbstractServerResponse( <del> int statusCode, HttpHeaders headers, MultiValueMap<String, ResponseCookie> cookies) { <add> int statusCode, HttpHeaders headers, MultiValueMap<String, ResponseCookie> cookies, <add> Map<String, Object> hints) { <ide> <ide> this.statusCode = statusCode; <ide> this.headers = HttpHeaders.readOnlyHttpHeaders(headers); <ide> this.cookies = CollectionUtils.unmodifiableMultiValueMap(new LinkedMultiValueMap<>(cookies)); <add> this.hints = hints; <ide> } <ide> <ide> @Override <ide> public WriterFunctionResponse(int statusCode, HttpHeaders headers, <ide> MultiValueMap<String, ResponseCookie> cookies, <ide> BiFunction<ServerWebExchange, Context, Mono<Void>> writeFunction) { <ide> <del> super(statusCode, headers, cookies); <add> super(statusCode, headers, cookies, Collections.emptyMap()); <ide> Assert.notNull(writeFunction, "BiFunction must not be null"); <ide> this.writeFunction = writeFunction; <ide> } <ide> protected Mono<Void> writeToInternal(ServerWebExchange exchange, Context context <ide> <ide> private final BodyInserter<T, ? super ServerHttpResponse> inserter; <ide> <del> private final Map<String, Object> hints; <ide> <ide> public BodyInserterResponse(int statusCode, HttpHeaders headers, <ide> MultiValueMap<String, ResponseCookie> cookies, <ide> BodyInserter<T, ? super ServerHttpResponse> body, Map<String, Object> hints) { <ide> <del> super(statusCode, headers, cookies); <add> super(statusCode, headers, cookies, hints); <ide> Assert.notNull(body, "BodyInserter must not be null"); <ide> this.inserter = body; <del> this.hints = hints; <ide> } <ide> <ide> @Override <ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilderTests.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2019 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> public List<ViewResolver> viewResolvers() { <ide> <ide> @Test <ide> public void from() { <del> ServerResponse other = ServerResponse.ok().header("foo", "bar").build().block(); <add> ResponseCookie cookie = ResponseCookie.from("foo", "bar").build(); <add> ServerResponse other = ServerResponse.ok().header("foo", "bar") <add> .cookie(cookie) <add> .hint("foo", "bar") <add> .build().block(); <add> <ide> Mono<ServerResponse> result = ServerResponse.from(other).build(); <ide> StepVerifier.create(result) <ide> .expectNextMatches(response -> HttpStatus.OK.equals(response.statusCode()) && <del> "bar".equals(response.headers().getFirst("foo"))) <add> "bar".equals(response.headers().getFirst("foo")) && <add> cookie.equals(response.cookies().getFirst("foo"))) <ide> .expectComplete() <ide> .verify(); <ide> }
4
Python
Python
fix minio website from the driver
7633f49f82a60ee83825a4ebbfad1aa65e620868
<ide><path>libcloud/storage/drivers/minio.py <ide> def __init__(self, user_id, key, secure=True, host=None, port=None, <ide> <ide> class MinIOStorageDriver(BaseS3StorageDriver): <ide> name = 'MinIO Storage Driver' <del> website = 'http://cloud.google.com/storage' <add> website = 'https://min.io/' <ide> connectionCls = MinIOConnectionAWS4 <ide> region_name = "" <ide>
1
PHP
PHP
add test case
9fd2af96a87c079483b01ce26cad180015bdb9c9
<ide><path>lib/Cake/Test/Case/Controller/ControllerTest.php <ide> public function beforeRender(Controller $controller) { <ide> <ide> class Test2Component extends TestComponent { <ide> <add> public $model; <add> <add> public function __construct(ComponentCollection $collection, $settings) { <add> $this->controller = $collection->getController(); <add> $this->model = $this->controller->modelClass; <add> } <add> <ide> public function beforeRender(Controller $controller) { <ide> return false; <ide> } <ide> public function testConstructClasses() { <ide> $this->assertTrue(is_a($Controller->TestPluginPost, 'TestPluginPost')); <ide> } <ide> <add>/** <add> * testConstructClassesWithComponents method <add> * <add> * @return void <add> */ <add> public function testConstructClassesWithComponents() { <add> $Controller = new TestPluginController(new CakeRequest(), new CakeResponse()); <add> $Controller->uses = array('NameTest'); <add> $Controller->components[] = 'Test2'; <add> <add> $Controller->constructClasses(); <add> $this->assertEquals('NameTest', $Controller->Test2->model); <add> $this->assertEquals('Name', $Controller->NameTest->name); <add> $this->assertEquals('Name', $Controller->NameTest->alias); <add> } <add> <ide> /** <ide> * testAliasName method <ide> *
1
Go
Go
add constants for aufs whiteout files
2fb5d0c32376951ef41a6f64bb7dbd8f6fd14fba
<ide><path>daemon/graphdriver/aufs/aufs.go <ide> func (a *Driver) Diff(id, parent string) (archive.Archive, error) { <ide> // AUFS doesn't need the parent layer to produce a diff. <ide> return archive.TarWithOptions(path.Join(a.rootPath(), "diff", id), &archive.TarOptions{ <ide> Compression: archive.Uncompressed, <del> ExcludePatterns: []string{".wh..wh.*", "!.wh..wh..opq"}, <add> ExcludePatterns: []string{archive.WhiteoutMetaPrefix + "*", "!" + archive.WhiteoutOpaqueDir}, <ide> }) <ide> } <ide> <ide><path>pkg/archive/changes.go <ide> func Changes(layers []string, rw string) ([]Change, error) { <ide> } <ide> <ide> // Skip AUFS metadata <del> if matched, err := filepath.Match(string(os.PathSeparator)+".wh..wh.*", path); err != nil || matched { <add> if matched, err := filepath.Match(string(os.PathSeparator)+WhiteoutMetaPrefix+"*", path); err != nil || matched { <ide> return err <ide> } <ide> <ide> func Changes(layers []string, rw string) ([]Change, error) { <ide> // Find out what kind of modification happened <ide> file := filepath.Base(path) <ide> // If there is a whiteout, then the file was removed <del> if strings.HasPrefix(file, ".wh.") { <del> originalFile := file[len(".wh."):] <add> if strings.HasPrefix(file, WhiteoutPrefix) { <add> originalFile := file[len(WhiteoutPrefix):] <ide> change.Path = filepath.Join(filepath.Dir(path), originalFile) <ide> change.Kind = ChangeDelete <ide> } else { <ide> func ExportChanges(dir string, changes []Change) (Archive, error) { <ide> if change.Kind == ChangeDelete { <ide> whiteOutDir := filepath.Dir(change.Path) <ide> whiteOutBase := filepath.Base(change.Path) <del> whiteOut := filepath.Join(whiteOutDir, ".wh."+whiteOutBase) <add> whiteOut := filepath.Join(whiteOutDir, WhiteoutPrefix+whiteOutBase) <ide> timestamp := time.Now() <ide> hdr := &tar.Header{ <ide> Name: whiteOut[1:], <ide><path>pkg/archive/diff.go <ide> func UnpackLayer(dest string, layer Reader) (size int64, err error) { <ide> } <ide> <ide> // Skip AUFS metadata dirs <del> if strings.HasPrefix(hdr.Name, ".wh..wh.") { <add> if strings.HasPrefix(hdr.Name, WhiteoutMetaPrefix) { <ide> // Regular files inside /.wh..wh.plnk can be used as hardlink targets <ide> // We don't want this directory, but we need the files in them so that <ide> // such hardlinks can be resolved. <del> if strings.HasPrefix(hdr.Name, ".wh..wh.plnk") && hdr.Typeflag == tar.TypeReg { <add> if strings.HasPrefix(hdr.Name, WhiteoutLinkDir) && hdr.Typeflag == tar.TypeReg { <ide> basename := filepath.Base(hdr.Name) <ide> aufsHardlinks[basename] = hdr <ide> if aufsTempdir == "" { <ide> func UnpackLayer(dest string, layer Reader) (size int64, err error) { <ide> } <ide> } <ide> <del> if hdr.Name != ".wh..wh..opq" { <add> if hdr.Name != WhiteoutOpaqueDir { <ide> continue <ide> } <ide> } <ide> func UnpackLayer(dest string, layer Reader) (size int64, err error) { <ide> } <ide> base := filepath.Base(path) <ide> <del> if strings.HasPrefix(base, ".wh.") { <del> originalBase := base[len(".wh."):] <add> if strings.HasPrefix(base, WhiteoutPrefix) { <ide> dir := filepath.Dir(path) <del> if originalBase == ".wh..opq" { <add> if base == WhiteoutOpaqueDir { <ide> fi, err := os.Lstat(dir) <ide> if err != nil && !os.IsNotExist(err) { <ide> return 0, err <ide> func UnpackLayer(dest string, layer Reader) (size int64, err error) { <ide> return 0, err <ide> } <ide> } else { <add> originalBase := base[len(WhiteoutPrefix):] <ide> originalPath := filepath.Join(dir, originalBase) <ide> if err := os.RemoveAll(originalPath); err != nil { <ide> return 0, err <ide> func UnpackLayer(dest string, layer Reader) (size int64, err error) { <ide> <ide> // Hard links into /.wh..wh.plnk don't work, as we don't extract that directory, so <ide> // we manually retarget these into the temporary files we extracted them into <del> if hdr.Typeflag == tar.TypeLink && strings.HasPrefix(filepath.Clean(hdr.Linkname), ".wh..wh.plnk") { <add> if hdr.Typeflag == tar.TypeLink && strings.HasPrefix(filepath.Clean(hdr.Linkname), WhiteoutLinkDir) { <ide> linkBasename := filepath.Base(hdr.Linkname) <ide> srcHdr = aufsHardlinks[linkBasename] <ide> if srcHdr == nil { <ide><path>pkg/archive/whiteouts.go <add>package archive <add> <add>// Whiteouts are files with a special meaning for the layered filesystem. <add>// Docker uses AUFS whiteout files inside exported archives. In other <add>// filesystems these files are generated/handled on tar creation/extraction. <add> <add>// WhiteoutPrefix prefix means file is a whiteout. If this is followed by a <add>// filename this means that file has been removed from the base layer. <add>const WhiteoutPrefix = ".wh." <add> <add>// WhiteoutMetaPrefix prefix means whiteout has a special meaning and is not <add>// for remoing an actaul file. Normally these files are excluded from exported <add>// archives. <add>const WhiteoutMetaPrefix = WhiteoutPrefix + WhiteoutPrefix <add> <add>// WhiteoutLinkDir is a directory AUFS uses for storing hardlink links to other <add>// layers. Normally these should not go into exported archives and all changed <add>// hardlinks should be copied to the top layer. <add>const WhiteoutLinkDir = WhiteoutMetaPrefix + "plnk" <add> <add>// WhiteoutOpaqueDir file means directory has been made opaque - meaning <add>// readdir calls to this directory do not follow to lower layers. <add>const WhiteoutOpaqueDir = WhiteoutMetaPrefix + ".opq"
4
Text
Text
remove react 18 issue template
b76103d66fdb7396cbfcc66a032b31a0cd8ad342
<ide><path>.github/ISSUE_TEMPLATE/react_18.md <del>--- <del>name: "💬 React 18" <del>about: Bug reports, questions, and general feedback about React 18 <del>title: 'React 18 ' <del>labels: 'Type: Discussion, React 18' <del> <del>--- <del> <del><!-- <del> Ask a question or share feedback about the React 18 release here. <del>-->
1
Python
Python
finish last commit
03d55d273251fe7612bbe0e729b7d2eaf3b50e17
<ide><path>test/test_linode.py <ide> def d(response): return base64.b64decode(response) <ide> avail_distributions = "eyJFUlJPUkFSUkFZIjpbXSwiQUNUSU9OIjoiYXZhaWwuZGlzdHJpYnV0aW9ucyIsIkRBVEEiOlt7IklTNjRCSVQiOjAsIkxBQkVMIjoiQXJjaCBMaW51eCAyMDA3LjA4IiwiTUlOSU1BR0VTSVpFIjo0MzYsIkRJU1RSSUJVVElPTklEIjozOCwiQ1JFQVRFX0RUIjoiMjAwNy0xMC0yNCAwMDowMDowMC4wIn0seyJJUzY0QklUIjowLCJMQUJFTCI6IkNlbnRvcyA1LjAiLCJNSU5JTUFHRVNJWkUiOjU5NCwiRElTVFJJQlVUSU9OSUQiOjMyLCJDUkVBVEVfRFQiOiIyMDA3LTA0LTI3IDAwOjAwOjAwLjAifSx7IklTNjRCSVQiOjAsIkxBQkVMIjoiQ2VudG9zIDUuMiIsIk1JTklNQUdFU0laRSI6OTUwLCJESVNUUklCVVRJT05JRCI6NDYsIkNSRUFURV9EVCI6IjIwMDgtMTEtMzAgMDA6MDA6MDAuMCJ9LHsiSVM2NEJJVCI6MSwiTEFCRUwiOiJDZW50b3MgNS4yIDY0Yml0IiwiTUlOSU1BR0VTSVpFIjo5ODAsIkRJU1RSSUJVVElPTklEIjo0NywiQ1JFQVRFX0RUIjoiMjAwOC0xMS0zMCAwMDowMDowMC4wIn0seyJJUzY0QklUIjowLCJMQUJFTCI6IkRlYmlhbiA0LjAiLCJNSU5JTUFHRVNJWkUiOjIwMCwiRElTVFJJQlVUSU9OSUQiOjI4LCJDUkVBVEVfRFQiOiIyMDA3LTA0LTE4IDAwOjAwOjAwLjAifSx7IklTNjRCSVQiOjEsIkxBQkVMIjoiRGViaWFuIDQuMCA2NGJpdCIsIk1JTklNQUdFU0laRSI6MjIwLCJESVNUUklCVVRJT05JRCI6NDgsIkNSRUFURV9EVCI6IjIwMDgtMTItMDIgMDA6MDA6MDAuMCJ9LHsiSVM2NEJJVCI6MCwiTEFCRUwiOiJEZWJpYW4gNS4wIiwiTUlOSU1BR0VTSVpFIjoyMDAsIkRJU1RSSUJVVElPTklEIjo1MCwiQ1JFQVRFX0RUIjoiMjAwOS0wMi0xOSAwMDowMDowMC4wIn0seyJJUzY0QklUIjoxLCJMQUJFTCI6IkRlYmlhbiA1LjAgNjRiaXQiLCJNSU5JTUFHRVNJWkUiOjMwMCwiRElTVFJJQlVUSU9OSUQiOjUxLCJDUkVBVEVfRFQiOiIyMDA5LTAyLTE5IDAwOjAwOjAwLjAifSx7IklTNjRCSVQiOjAsIkxBQkVMIjoiRmVkb3JhIDgiLCJNSU5JTUFHRVNJWkUiOjc0MCwiRElTVFJJQlVUSU9OSUQiOjQwLCJDUkVBVEVfRFQiOiIyMDA3LTExLTA5IDAwOjAwOjAwLjAifSx7IklTNjRCSVQiOjAsIkxBQkVMIjoiRmVkb3JhIDkiLCJNSU5JTUFHRVNJWkUiOjExNzUsIkRJU1RSSUJVVElPTklEIjo0MywiQ1JFQVRFX0RUIjoiMjAwOC0wNi0wOSAxNToxNToyMS4wIn0seyJJUzY0QklUIjowLCJMQUJFTCI6IkdlbnRvbyAyMDA3LjAiLCJNSU5JTUFHRVNJWkUiOjE4MDAsIkRJU1RSSUJVVElPTklEIjozNSwiQ1JFQVRFX0RUIjoiMjAwNy0wOC0yOSAwMDowMDowMC4wIn0seyJJUzY0QklUIjowLCJMQUJFTCI6IkdlbnRvbyAyMDA4LjAiLCJNSU5JTUFHRVNJWkUiOjE1MDAsIkRJU1RSSUJVVElPTklEIjo1MiwiQ1JFQVRFX0RUIjoiMjAwOS0wMy0yMCAwMDowMDowMC4wIn0seyJJUzY0QklUIjoxLCJMQUJFTCI6IkdlbnRvbyAyMDA4LjAgNjRiaXQiLCJNSU5JTUFHRVNJWkUiOjI1MDAsIkRJU1RSSUJVVElPTklEIjo1MywiQ1JFQVRFX0RUIjoiMjAwOS0wNC0wNCAwMDowMDowMC4wIn0seyJJUzY0QklUIjowLCJMQUJFTCI6Ik9wZW5TVVNFIDExLjAiLCJNSU5JTUFHRVNJWkUiOjg1MCwiRElTVFJJQlVUSU9OSUQiOjQ0LCJDUkVBVEVfRFQiOiIyMDA4LTA4LTIxIDA4OjMyOjE2LjAifSx7IklTNjRCSVQiOjAsIkxBQkVMIjoiU2xhY2t3YXJlIDEyLjAiLCJNSU5JTUFHRVNJWkUiOjMxNSwiRElTVFJJQlVUSU9OSUQiOjM0LCJDUkVBVEVfRFQiOiIyMDA3LTA3LTE2IDAwOjAwOjAwLjAifSx7IklTNjRCSVQiOjAsIkxBQkVMIjoiU2xhY2t3YXJlIDEyLjIiLCJNSU5JTUFHRVNJWkUiOjUwMCwiRElTVFJJQlVUSU9OSUQiOjU0LCJDUkVBVEVfRFQiOiIyMDA5LTA0LTA0IDAwOjAwOjAwLjAifSx7IklTNjRCSVQiOjAsIkxBQkVMIjoiVWJ1bnR1IDguMDQgTFRTIiwiTUlOSU1BR0VTSVpFIjo0MDAsIkRJU1RSSUJVVElPTklEIjo0MSwiQ1JFQVRFX0RUIjoiMjAwOC0wNC0yMyAxNToxMToyOS4wIn0seyJJUzY0QklUIjoxLCJMQUJFTCI6IlVidW50dSA4LjA0IExUUyA2NGJpdCIsIk1JTklNQUdFU0laRSI6MzUwLCJESVNUUklCVVRJT05JRCI6NDIsIkNSRUFURV9EVCI6IjIwMDgtMDYtMDMgMTI6NTE6MTEuMCJ9LHsiSVM2NEJJVCI6MCwiTEFCRUwiOiJVYnVudHUgOC4xMCIsIk1JTklNQUdFU0laRSI6MjIwLCJESVNUUklCVVRJT05JRCI6NDUsIkNSRUFURV9EVCI6IjIwMDgtMTAtMzAgMjM6MjM6MDMuMCJ9LHsiSVM2NEJJVCI6MSwiTEFCRUwiOiJVYnVudHUgOC4xMCA2NGJpdCIsIk1JTklNQUdFU0laRSI6MjMwLCJESVNUUklCVVRJT05JRCI6NDksIkNSRUFURV9EVCI6IjIwMDgtMTItMDIgMDA6MDA6MDAuMCJ9LHsiSVM2NEJJVCI6MCwiTEFCRUwiOiJVYnVudHUgOS4wNCIsIk1JTklNQUdFU0laRSI6MzUwLCJESVNUUklCVVRJT05JRCI6NTUsIkNSRUFURV9EVCI6IjIwMDktMDQtMjMgMDA6MDA6MDAuMCJ9LHsiSVM2NEJJVCI6MSwiTEFCRUwiOiJVYnVudHUgOS4wNCA2NGJpdCIsIk1JTklNQUdFU0laRSI6MzUwLCJESVNUUklCVVRJT05JRCI6NTYsIkNSRUFURV9EVCI6IjIwMDktMDQtMjMgMDA6MDA6MDAuMCJ9XX0=" <ide> linode_list = "ewogICAiRVJST1JBUlJBWSI6W10sCiAgICJBQ1RJT04iOiJsaW5vZGUubGlzdCIsCiAgICJEQVRBIjpbCiAgICAgIHsKICAgICAgICAgIlRPVEFMWEZFUiI6MjAwLAogICAgICAgICAiQkFDS1VQU0VOQUJMRUQiOjEsCiAgICAgICAgICJXQVRDSERPRyI6MSwKICAgICAgICAgIkxQTV9ESVNQTEFZR1JPVVAiOiIiLAogICAgICAgICAiQUxFUlRfQldRVU9UQV9FTkFCTEVEIjoxLAogICAgICAgICAiU1RBVFVTIjoyLAogICAgICAgICAiVE9UQUxSQU0iOjU0MCwKICAgICAgICAgIkFMRVJUX0RJU0tJT19USFJFU0hPTEQiOjIwMCwKICAgICAgICAgIkJBQ0tVUFdJTkRPVyI6MSwKICAgICAgICAgIkFMRVJUX0JXT1VUX0VOQUJMRUQiOjEsCiAgICAgICAgICJBTEVSVF9CV09VVF9USFJFU0hPTEQiOjUsCiAgICAgICAgICJMQUJFTCI6ImFwaS1ub2RlMyIsCiAgICAgICAgICJBTEVSVF9DUFVfRU5BQkxFRCI6MSwKICAgICAgICAgIkFMRVJUX0JXUVVPVEFfVEhSRVNIT0xEIjo4MSwKICAgICAgICAgIkFMRVJUX0JXSU5fVEhSRVNIT0xEIjo1LAogICAgICAgICAiQkFDS1VQV0VFS0xZREFZIjowLAogICAgICAgICAiREFUQUNFTlRFUklEIjo1LAogICAgICAgICAiQUxFUlRfQ1BVX1RIUkVTSE9MRCI6MTAsCiAgICAgICAgICJUT1RBTEhEIjoxMDAsCiAgICAgICAgICJBTEVSVF9ESVNLSU9fRU5BQkxFRCI6MSwKICAgICAgICAgIkFMRVJUX0JXSU5fRU5BQkxFRCI6MSwKICAgICAgICAgIkxJTk9ERUlEIjo4MDk4CiAgICAgIH0KICAgXQp9" <ide> linode_ip_list = "ewogICAiRVJST1JBUlJBWSI6W10sCiAgICJBQ1RJT04iOiJsaW5vZGUuaXAubGlzdCIsCiAgICJEQVRBIjpbCiAgICAgIHsKICAgICAgICAgIkxJTk9ERUlEIjo4MDk4LAogICAgICAgICAiSVNQVUJMSUMiOjEsCiAgICAgICAgICJJUEFERFJFU1MiOiI3NS4xMjcuOTYuNTQiLAogICAgICAgICAiUkROU19OQU1FIjoibGkyMi01NC5tZW1iZXJzLmxpbm9kZS5jb20iLAogICAgICAgICAiSVBBRERSRVNTSUQiOjUzODQKICAgICAgfSwKICAgICAgewogICAgICAgICAiTElOT0RFSUQiOjgwOTgsCiAgICAgICAgICJJU1BVQkxJQyI6MSwKICAgICAgICAgIklQQUREUkVTUyI6Ijc1LjEyNy45Ni4yNDUiLAogICAgICAgICAiUkROU19OQU1FIjoibGkyMi0yNDUubWVtYmVycy5saW5vZGUuY29tIiwKICAgICAgICAgIklQQUREUkVTU0lEIjo1NTc1CiAgICAgIH0KICAgXQp9" <del>linode_reboot = "eyJFUlJPUkFSUkFZIjpbXSwiQUNUSU9OIjoibGlub2RlLnJlYm9vdCIsIkRBVEEiOnsiSm9iSUQiOjIxMjd9fQ==" <ide> <ide> class LinodeTest(unittest.TestCase): <ide> # The Linode test suite <ide> def _avail_distributions(self, method, url, body, headers): <ide> return (httplib.OK, d(avail_distributions), {}, httplib.responses[httplib.OK]) <ide> <ide> def _linode_list(self, method, url, body, headers): <del> body = """{ <del> "ERRORARRAY":[], <del> "ACTION":"linode.list", <del> "DATA":[ <del> { <del> "TOTALXFER":200, <del> "BACKUPSENABLED":1, <del> "WATCHDOG":1, <del> "LPM_DISPLAYGROUP":"", <del> "ALERT_BWQUOTA_ENABLED":1, <del> "STATUS":2, <del> "TOTALRAM":540, <del> "ALERT_DISKIO_THRESHOLD":200, <del> "BACKUPWINDOW":1, <del> "ALERT_BWOUT_ENABLED":1, <del> "ALERT_BWOUT_THRESHOLD":5, <del> "LABEL":"api-node3", <del> "ALERT_CPU_ENABLED":1, <del> "ALERT_BWQUOTA_THRESHOLD":81, <del> "ALERT_BWIN_THRESHOLD":5, <del> "BACKUPWEEKLYDAY":0, <del> "DATACENTERID":5, <del> "ALERT_CPU_THRESHOLD":10, <del> "TOTALHD":100, <del> "ALERT_DISKIO_ENABLED":1, <del> "ALERT_BWIN_ENABLED":1, <del> "LINODEID":8098 <del> } <del> ] <del>}""" <del> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <add> return (httplib.OK, d(linode_list), {}, httplib.responses[httplib.OK]) <ide> <ide> def _linode_ip_list(self, method, url, body, headers): <del> body = """""" <del> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <add> return (httplib.OK, d(linode_ip_list), {}, httplib.responses[httplib.OK])
1
Javascript
Javascript
add note about using the `g` flag
19ec9936fe2ab272d6df42854fb4af57419476c1
<ide><path>src/ng/directive/input.js <ide> var inputType = { <ide> * as in the ngPattern directive. <ide> * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match <ide> * a RegExp found by evaluating the Angular expression given in the attribute value. <del> * If the expression evaluates to a RegExp object then this is used directly. <del> * If the expression is a string then it will be converted to a RegExp after wrapping it in `^` and `$` <del> * characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`. <add> * If the expression evaluates to a RegExp object, then this is used directly. <add> * If the expression evaluates to a string, then it will be converted to a RegExp <add> * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to <add> * `new RegExp('^abc$')`.<br /> <add> * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to <add> * start at the index of the last search's match, thus not taking the whole input value into <add> * account. <ide> * @param {string=} ngChange Angular expression to be executed when input changes due to user <ide> * interaction with the input element. <ide> * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input. <ide> var inputType = { <ide> * as in the ngPattern directive. <ide> * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match <ide> * a RegExp found by evaluating the Angular expression given in the attribute value. <del> * If the expression evaluates to a RegExp object then this is used directly. <del> * If the expression is a string then it will be converted to a RegExp after wrapping it in `^` and `$` <del> * characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`. <add> * If the expression evaluates to a RegExp object, then this is used directly. <add> * If the expression evaluates to a string, then it will be converted to a RegExp <add> * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to <add> * `new RegExp('^abc$')`.<br /> <add> * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to <add> * start at the index of the last search's match, thus not taking the whole input value into <add> * account. <ide> * @param {string=} ngChange Angular expression to be executed when input changes due to user <ide> * interaction with the input element. <ide> * <ide> var inputType = { <ide> * as in the ngPattern directive. <ide> * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match <ide> * a RegExp found by evaluating the Angular expression given in the attribute value. <del> * If the expression evaluates to a RegExp object then this is used directly. <del> * If the expression is a string then it will be converted to a RegExp after wrapping it in `^` and `$` <del> * characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`. <add> * If the expression evaluates to a RegExp object, then this is used directly. <add> * If the expression evaluates to a string, then it will be converted to a RegExp <add> * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to <add> * `new RegExp('^abc$')`.<br /> <add> * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to <add> * start at the index of the last search's match, thus not taking the whole input value into <add> * account. <ide> * @param {string=} ngChange Angular expression to be executed when input changes due to user <ide> * interaction with the input element. <ide> * <ide> var inputType = { <ide> * as in the ngPattern directive. <ide> * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match <ide> * a RegExp found by evaluating the Angular expression given in the attribute value. <del> * If the expression evaluates to a RegExp object then this is used directly. <del> * If the expression is a string then it will be converted to a RegExp after wrapping it in `^` and `$` <del> * characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`. <add> * If the expression evaluates to a RegExp object, then this is used directly. <add> * If the expression evaluates to a string, then it will be converted to a RegExp <add> * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to <add> * `new RegExp('^abc$')`.<br /> <add> * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to <add> * start at the index of the last search's match, thus not taking the whole input value into <add> * account. <ide> * @param {string=} ngChange Angular expression to be executed when input changes due to user <ide> * interaction with the input element. <ide> * <ide> function checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filt <ide> * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than <ide> * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any <ide> * length. <del> * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the <del> * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for <del> * patterns defined as scope expressions. <add> * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match <add> * a RegExp found by evaluating the Angular expression given in the attribute value. <add> * If the expression evaluates to a RegExp object, then this is used directly. <add> * If the expression evaluates to a string, then it will be converted to a RegExp <add> * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to <add> * `new RegExp('^abc$')`.<br /> <add> * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to <add> * start at the index of the last search's match, thus not taking the whole input value into <add> * account. <ide> * @param {string=} ngChange Angular expression to be executed when input changes due to user <ide> * interaction with the input element. <ide> * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input. <ide> function checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filt <ide> * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than <ide> * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any <ide> * length. <del> * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the <del> * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for <del> * patterns defined as scope expressions. <add> * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match <add> * a RegExp found by evaluating the Angular expression given in the attribute value. <add> * If the expression evaluates to a RegExp object, then this is used directly. <add> * If the expression evaluates to a string, then it will be converted to a RegExp <add> * after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to <add> * `new RegExp('^abc$')`.<br /> <add> * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to <add> * start at the index of the last search's match, thus not taking the whole input value into <add> * account. <ide> * @param {string=} ngChange Angular expression to be executed when input changes due to user <ide> * interaction with the input element. <ide> * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
1
Text
Text
add cdn link
4fe60f500f7b15c360e06dabbaeabf1a124b865b
<ide><path>guide/english/bootstrap/index.md <ide> Adding the JavaScript elements of Bootstrap is similar with `<script>` elements <ide> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> <ide> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script> <ide> ``` <del>_Note: These are only examples and may change without notice. Please refer to a CDN for current links to include in your project._ <add>_Note: These are only examples and may change without notice. Please refer to a CDN for current links to include in your project. You can find the latest CDN links _<a href='https://www.bootstrapcdn.com/' target='_blank' rel='nofollow'>here</a>_._ <ide> <ide> ##### Download/Install <ide>
1
Javascript
Javascript
remove unused parameter
0004ffa5da1437c5c104ab64c170b158e596f22d
<ide><path>lib/zlib.js <ide> Zlib.prototype._transform = function(chunk, encoding, cb) { <ide> req.callback = callback; <ide> <ide> var self = this; <del> function callback(availInAfter, availOutAfter, buffer) { <add> function callback(availInAfter, availOutAfter) { <ide> if (self._hadError) <ide> return; <ide>
1
Python
Python
remove columns before passing to data collator
7b95825d7dddb5896397c806119d1819325c25ff
<ide><path>src/transformers/trainer.py <ide> def _set_signature_columns_if_needed(self): <ide> # Inspect model forward signature to keep only the arguments it accepts. <ide> signature = inspect.signature(self.model.forward) <ide> self._signature_columns = list(signature.parameters.keys()) <add> # Labels may be named label or label_ids, the default data collator handles that. <add> self._signature_columns += list(set(["label", "label_ids"] + self.label_names)) <ide> <ide> def _remove_unused_columns(self, dataset: "datasets.Dataset", description: Optional[str] = None): <ide> if not self.args.remove_unused_columns: <ide> return dataset <ide> self._set_signature_columns_if_needed() <del> # Labels may be named label or label_ids, the default data collator handles that. <del> signature_columns = self._signature_columns + ["label", "label_ids"] <add> signature_columns = self._signature_columns <ide> <ide> ignored_columns = list(set(dataset.column_names) - set(signature_columns)) <ide> if len(ignored_columns) > 0: <ide> def _get_collator_with_removed_columns( <ide> if not self.args.remove_unused_columns: <ide> return data_collator <ide> self._set_signature_columns_if_needed() <del> signature_columns = self._signature_columns + self.label_names <add> signature_columns = self._signature_columns <ide> <ide> remove_columns_collator = RemoveColumnsCollator( <ide> data_collator=data_collator, <ide><path>src/transformers/trainer_utils.py <ide> class FSDPOption(ExplicitEnum): <ide> <ide> <ide> class RemoveColumnsCollator: <del> """Wrap the data collator to remove unused columns from its output.""" <add> """Wrap the data collator to remove unused columns before they are passed to the collator.""" <ide> <ide> def __init__( <ide> self, <ide> def _remove_columns(self, feature: dict) -> dict: <ide> return {k: v for k, v in feature.items() if k in self.signature_columns} <ide> <ide> def __call__(self, features: List[dict]): <del> return self._remove_columns(self.data_collator(features)) <add> features = [self._remove_columns(feature) for feature in features] <add> return self.data_collator(features)
2
Mixed
Go
add typetmpfs to api/types/mount
18768fdc2e76ec6c600c8ab57d2d487ee7877794
<ide><path>api/types/mount/mount.go <ide> package mount <ide> <add>import ( <add> "os" <add>) <add> <ide> // Type represents the type of a mount. <ide> type Type string <ide> <add>// Type constants <ide> const ( <del> // TypeBind BIND <add> // TypeBind is the type for mounting host dir <ide> TypeBind Type = "bind" <del> // TypeVolume VOLUME <add> // TypeVolume is the type for remote storage volumes <ide> TypeVolume Type = "volume" <add> // TypeTmpfs is the type for mounting tmpfs <add> TypeTmpfs Type = "tmpfs" <ide> ) <ide> <ide> // Mount represents a mount (volume). <ide> type Mount struct { <del> Type Type `json:",omitempty"` <add> Type Type `json:",omitempty"` <add> // Source specifies the name of the mount. Depending on mount type, this <add> // may be a volume name or a host path, or even ignored. <add> // Source is not supported for tmpfs (must be an empty value) <ide> Source string `json:",omitempty"` <ide> Target string `json:",omitempty"` <ide> ReadOnly bool `json:",omitempty"` <ide> <ide> BindOptions *BindOptions `json:",omitempty"` <ide> VolumeOptions *VolumeOptions `json:",omitempty"` <add> TmpfsOptions *TmpfsOptions `json:",omitempty"` <ide> } <ide> <ide> // Propagation represents the propagation of a mount. <ide> type Driver struct { <ide> Name string `json:",omitempty"` <ide> Options map[string]string `json:",omitempty"` <ide> } <add> <add>// TmpfsOptions defines options specific to mounts of type "tmpfs". <add>type TmpfsOptions struct { <add> // Size sets the size of the tmpfs, in bytes. <add> // <add> // This will be converted to an operating system specific value <add> // depending on the host. For example, on linux, it will be convered to <add> // use a 'k', 'm' or 'g' syntax. BSD, though not widely supported with <add> // docker, uses a straight byte value. <add> // <add> // Percentages are not supported. <add> SizeBytes int64 `json:",omitempty"` <add> // Mode of the tmpfs upon creation <add> Mode os.FileMode `json:",omitempty"` <add> <add> // TODO(stevvooe): There are several more tmpfs flags, specified in the <add> // daemon, that are accepted. Only the most basic are added for now. <add> // <add> // From docker/docker/pkg/mount/flags.go: <add> // <add> // var validFlags = map[string]bool{ <add> // "": true, <add> // "size": true, X <add> // "mode": true, X <add> // "uid": true, <add> // "gid": true, <add> // "nr_inodes": true, <add> // "nr_blocks": true, <add> // "mpol": true, <add> // } <add> // <add> // Some of these may be straightforward to add, but others, such as <add> // uid/gid have implications in a clustered system. <add>} <ide><path>container/container_unix.go <ide> import ( <ide> <ide> "github.com/Sirupsen/logrus" <ide> containertypes "github.com/docker/docker/api/types/container" <add> mounttypes "github.com/docker/docker/api/types/mount" <ide> "github.com/docker/docker/pkg/chrootarchive" <ide> "github.com/docker/docker/pkg/stringid" <ide> "github.com/docker/docker/pkg/symlink" <ide> func copyOwnership(source, destination string) error { <ide> } <ide> <ide> // TmpfsMounts returns the list of tmpfs mounts <del>func (container *Container) TmpfsMounts() []Mount { <add>func (container *Container) TmpfsMounts() ([]Mount, error) { <ide> var mounts []Mount <ide> for dest, data := range container.HostConfig.Tmpfs { <ide> mounts = append(mounts, Mount{ <ide> func (container *Container) TmpfsMounts() []Mount { <ide> Data: data, <ide> }) <ide> } <del> return mounts <add> for dest, mnt := range container.MountPoints { <add> if mnt.Type == mounttypes.TypeTmpfs { <add> data, err := volume.ConvertTmpfsOptions(mnt.Spec.TmpfsOptions) <add> if err != nil { <add> return nil, err <add> } <add> mounts = append(mounts, Mount{ <add> Source: "tmpfs", <add> Destination: dest, <add> Data: data, <add> }) <add> } <add> } <add> return mounts, nil <ide> } <ide> <ide> // cleanResourcePath cleans a resource path and prepares to combine with mnt path <ide><path>container/container_windows.go <ide> func (container *Container) UnmountVolumes(forceSyscall bool, volumeEventLog fun <ide> } <ide> <ide> // TmpfsMounts returns the list of tmpfs mounts <del>func (container *Container) TmpfsMounts() []Mount { <add>func (container *Container) TmpfsMounts() ([]Mount, error) { <ide> var mounts []Mount <del> return mounts <add> return mounts, nil <ide> } <ide> <ide> // UpdateContainer updates configuration of a container <ide><path>daemon/oci_linux.go <ide> func setMounts(daemon *Daemon, s *specs.Spec, c *container.Container, mounts []c <ide> } <ide> <ide> if m.Source == "tmpfs" { <del> data := c.HostConfig.Tmpfs[m.Destination] <add> data := m.Data <ide> options := []string{"noexec", "nosuid", "nodev", string(volume.DefaultPropagationMode)} <ide> if data != "" { <ide> options = append(options, strings.Split(data, ",")...) <ide> func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) { <ide> return nil, err <ide> } <ide> ms = append(ms, c.IpcMounts()...) <del> ms = append(ms, c.TmpfsMounts()...) <add> tmpfsMounts, err := c.TmpfsMounts() <add> if err != nil { <add> return nil, err <add> } <add> ms = append(ms, tmpfsMounts...) <ide> sort.Sort(mounts(ms)) <ide> if err := setMounts(daemon, &s, c, ms); err != nil { <ide> return nil, fmt.Errorf("linux mounts: %v", err) <ide><path>daemon/volumes_unix.go <ide> func (daemon *Daemon) setupMounts(c *container.Container) ([]container.Mount, er <ide> var mounts []container.Mount <ide> // TODO: tmpfs mounts should be part of Mountpoints <ide> tmpfsMounts := make(map[string]bool) <del> for _, m := range c.TmpfsMounts() { <add> tmpfsMountInfo, err := c.TmpfsMounts() <add> if err != nil { <add> return nil, err <add> } <add> for _, m := range tmpfsMountInfo { <ide> tmpfsMounts[m.Destination] = true <ide> } <ide> for _, m := range c.MountPoints { <ide><path>docs/reference/api/docker_remote_api.md <ide> This section lists each version from latest to oldest. Each listing includes a <ide> * `DELETE /volumes/(name)` now accepts a `force` query parameter to force removal of volumes that were already removed out of band by the volume driver plugin. <ide> * `POST /containers/create/` and `POST /containers/(name)/update` now validates restart policies. <ide> * `POST /containers/create` now validates IPAMConfig in NetworkingConfig, and returns error for invalid IPv4 and IPv6 addresses (`--ip` and `--ip6` in `docker create/run`). <del>* `POST /containers/create` now takes a `Mounts` field in `HostConfig` which replaces `Binds` and `Volumes`. *note*: `Binds` and `Volumes` are still available but are exclusive with `Mounts` <add>* `POST /containers/create` now takes a `Mounts` field in `HostConfig` which replaces `Binds`, `Volumes`, and `Tmpfs`. *note*: `Binds`, `Volumes`, and `Tmpfs` are still available and can be combined with `Mounts`. <ide> * `POST /build` now performs a preliminary validation of the `Dockerfile` before starting the build, and returns an error if the syntax is incorrect. Note that this change is _unversioned_ and applied to all API versions. <ide> * `POST /build` accepts `cachefrom` parameter to specify images used for build cache. <ide> * `GET /networks/` endpoint now correctly returns a list of *all* networks, <ide><path>docs/reference/api/docker_remote_api_v1.25.md <ide> Create a container <ide> - **Mounts** – Specification for mounts to be added to the container. <ide> - **Target** – Container path. <ide> - **Source** – Mount source (e.g. a volume name, a host path). <del> - **Type** – The mount type (`bind`, or `volume`). <add> - **Type** – The mount type (`bind`, `volume`, or `tmpfs`). <ide> Available types (for the `Type` field): <ide> - **bind** - Mounts a file or directory from the host into the container. Must exist prior to creating the container. <ide> - **volume** - Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed. <add> - **tmpfs** - Create a tmpfs with the given options. The mount source cannot be specified for tmpfs. <ide> - **ReadOnly** – A boolean indicating whether the mount should be read-only. <ide> - **BindOptions** - Optional configuration for the `bind` type. <ide> - **Propagation** – A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. <ide> Create a container <ide> - **DriverConfig** – Map of driver-specific options. <ide> - **Name** - Name of the driver to use to create the volume. <ide> - **Options** - key/value map of driver specific options. <add> - **TmpfsOptions** – Optional configuration for the `tmpfs` type. <add> - **SizeBytes** – The size for the tmpfs mount in bytes. <add> - **Mode** – The permission mode for the tmpfs mount in an integer. <ide> <ide> <ide> **Query parameters**: <ide><path>integration-cli/docker_api_containers_test.go <ide> func (s *DockerSuite) TestContainersAPICreateMountsValidation(c *check.C) { <ide> notExistPath := prefix + slash + "notexist" <ide> <ide> cases := []testCase{ <del> {cfg{Image: "busybox", HostConfig: hc{Mounts: []m{{Type: "notreal", Target: destPath}}}}, http.StatusBadRequest, "mount type unknown"}, <del> {cfg{Image: "busybox", HostConfig: hc{Mounts: []m{{Type: "bind"}}}}, http.StatusBadRequest, "Target must not be empty"}, <del> {cfg{Image: "busybox", HostConfig: hc{Mounts: []m{{Type: "bind", Target: destPath}}}}, http.StatusBadRequest, "Source must not be empty"}, <del> {cfg{Image: "busybox", HostConfig: hc{Mounts: []m{{Type: "bind", Source: notExistPath, Target: destPath}}}}, http.StatusBadRequest, "bind source path does not exist"}, <del> {cfg{Image: "busybox", HostConfig: hc{Mounts: []m{{Type: "volume"}}}}, http.StatusBadRequest, "Target must not be empty"}, <del> {cfg{Image: "busybox", HostConfig: hc{Mounts: []m{{Type: "volume", Source: "hello", Target: destPath}}}}, http.StatusCreated, ""}, <del> {cfg{Image: "busybox", HostConfig: hc{Mounts: []m{{Type: "volume", Source: "hello2", Target: destPath, VolumeOptions: &mounttypes.VolumeOptions{DriverConfig: &mounttypes.Driver{Name: "local"}}}}}}, http.StatusCreated, ""}, <add> { <add> config: cfg{ <add> Image: "busybox", <add> HostConfig: hc{ <add> Mounts: []m{{ <add> Type: "notreal", <add> Target: destPath}}}}, <add> status: http.StatusBadRequest, <add> msg: "mount type unknown", <add> }, <add> { <add> config: cfg{ <add> Image: "busybox", <add> HostConfig: hc{ <add> Mounts: []m{{ <add> Type: "bind"}}}}, <add> status: http.StatusBadRequest, <add> msg: "Target must not be empty", <add> }, <add> { <add> config: cfg{ <add> Image: "busybox", <add> HostConfig: hc{ <add> Mounts: []m{{ <add> Type: "bind", <add> Target: destPath}}}}, <add> status: http.StatusBadRequest, <add> msg: "Source must not be empty", <add> }, <add> { <add> config: cfg{ <add> Image: "busybox", <add> HostConfig: hc{ <add> Mounts: []m{{ <add> Type: "bind", <add> Source: notExistPath, <add> Target: destPath}}}}, <add> status: http.StatusBadRequest, <add> msg: "bind source path does not exist", <add> }, <add> { <add> config: cfg{ <add> Image: "busybox", <add> HostConfig: hc{ <add> Mounts: []m{{ <add> Type: "volume"}}}}, <add> status: http.StatusBadRequest, <add> msg: "Target must not be empty", <add> }, <add> { <add> config: cfg{ <add> Image: "busybox", <add> HostConfig: hc{ <add> Mounts: []m{{ <add> Type: "volume", <add> Source: "hello", <add> Target: destPath}}}}, <add> status: http.StatusCreated, <add> msg: "", <add> }, <add> { <add> config: cfg{ <add> Image: "busybox", <add> HostConfig: hc{ <add> Mounts: []m{{ <add> Type: "volume", <add> Source: "hello2", <add> Target: destPath, <add> VolumeOptions: &mounttypes.VolumeOptions{ <add> DriverConfig: &mounttypes.Driver{ <add> Name: "local"}}}}}}, <add> status: http.StatusCreated, <add> msg: "", <add> }, <ide> } <ide> <ide> if SameHostDaemon.Condition() { <ide> tmpDir, err := ioutils.TempDir("", "test-mounts-api") <ide> c.Assert(err, checker.IsNil) <ide> defer os.RemoveAll(tmpDir) <ide> cases = append(cases, []testCase{ <del> {cfg{Image: "busybox", HostConfig: hc{Mounts: []m{{Type: "bind", Source: tmpDir, Target: destPath}}}}, http.StatusCreated, ""}, <del> {cfg{Image: "busybox", HostConfig: hc{Mounts: []m{{Type: "bind", Source: tmpDir, Target: destPath, VolumeOptions: &mounttypes.VolumeOptions{}}}}}, http.StatusBadRequest, "VolumeOptions must not be specified"}, <add> { <add> config: cfg{ <add> Image: "busybox", <add> HostConfig: hc{ <add> Mounts: []m{{ <add> Type: "bind", <add> Source: tmpDir, <add> Target: destPath}}}}, <add> status: http.StatusCreated, <add> msg: "", <add> }, <add> { <add> config: cfg{ <add> Image: "busybox", <add> HostConfig: hc{ <add> Mounts: []m{{ <add> Type: "bind", <add> Source: tmpDir, <add> Target: destPath, <add> VolumeOptions: &mounttypes.VolumeOptions{}}}}}, <add> status: http.StatusBadRequest, <add> msg: "VolumeOptions must not be specified", <add> }, <ide> }...) <ide> } <ide> <ide> if DaemonIsLinux.Condition() { <ide> cases = append(cases, []testCase{ <del> {cfg{Image: "busybox", HostConfig: hc{Mounts: []m{{Type: "volume", Source: "hello3", Target: destPath, VolumeOptions: &mounttypes.VolumeOptions{DriverConfig: &mounttypes.Driver{Name: "local", Options: map[string]string{"o": "size=1"}}}}}}}, http.StatusCreated, ""}, <add> { <add> config: cfg{ <add> Image: "busybox", <add> HostConfig: hc{ <add> Mounts: []m{{ <add> Type: "volume", <add> Source: "hello3", <add> Target: destPath, <add> VolumeOptions: &mounttypes.VolumeOptions{ <add> DriverConfig: &mounttypes.Driver{ <add> Name: "local", <add> Options: map[string]string{"o": "size=1"}}}}}}}, <add> status: http.StatusCreated, <add> msg: "", <add> }, <add> { <add> config: cfg{ <add> Image: "busybox", <add> HostConfig: hc{ <add> Mounts: []m{{ <add> Type: "tmpfs", <add> Target: destPath}}}}, <add> status: http.StatusCreated, <add> msg: "", <add> }, <add> { <add> config: cfg{ <add> Image: "busybox", <add> HostConfig: hc{ <add> Mounts: []m{{ <add> Type: "tmpfs", <add> Target: destPath, <add> TmpfsOptions: &mounttypes.TmpfsOptions{ <add> SizeBytes: 4096 * 1024, <add> Mode: 0700, <add> }}}}}, <add> status: http.StatusCreated, <add> msg: "", <add> }, <add> <add> { <add> config: cfg{ <add> Image: "busybox", <add> HostConfig: hc{ <add> Mounts: []m{{ <add> Type: "tmpfs", <add> Source: "/shouldnotbespecified", <add> Target: destPath}}}}, <add> status: http.StatusBadRequest, <add> msg: "Source must not be specified", <add> }, <ide> }...) <ide> <ide> } <ide> func (s *DockerSuite) TestContainersAPICreateMountsCreate(c *check.C) { <ide> } <ide> } <ide> } <add> <add>func (s *DockerSuite) TestContainersAPICreateMountsTmpfs(c *check.C) { <add> testRequires(c, DaemonIsLinux) <add> type testCase struct { <add> cfg map[string]interface{} <add> expectedOptions []string <add> } <add> target := "/foo" <add> cases := []testCase{ <add> { <add> cfg: map[string]interface{}{ <add> "Type": "tmpfs", <add> "Target": target}, <add> expectedOptions: []string{"rw", "nosuid", "nodev", "noexec", "relatime"}, <add> }, <add> { <add> cfg: map[string]interface{}{ <add> "Type": "tmpfs", <add> "Target": target, <add> "TmpfsOptions": map[string]interface{}{ <add> "SizeBytes": 4096 * 1024, "Mode": 0700}}, <add> expectedOptions: []string{"rw", "nosuid", "nodev", "noexec", "relatime", "size=4096k", "mode=700"}, <add> }, <add> } <add> <add> for i, x := range cases { <add> cName := fmt.Sprintf("test-tmpfs-%d", i) <add> data := map[string]interface{}{ <add> "Image": "busybox", <add> "Cmd": []string{"/bin/sh", "-c", <add> fmt.Sprintf("mount | grep 'tmpfs on %s'", target)}, <add> "HostConfig": map[string]interface{}{"Mounts": []map[string]interface{}{x.cfg}}, <add> } <add> status, resp, err := sockRequest("POST", "/containers/create?name="+cName, data) <add> c.Assert(err, checker.IsNil, check.Commentf(string(resp))) <add> c.Assert(status, checker.Equals, http.StatusCreated, check.Commentf(string(resp))) <add> out, _ := dockerCmd(c, "start", "-a", cName) <add> for _, option := range x.expectedOptions { <add> c.Assert(out, checker.Contains, option) <add> } <add> } <add>} <ide><path>runconfig/config.go <ide> func DecodeContainerConfig(src io.Reader) (*container.Config, *container.HostCon <ide> } <ide> <ide> // Now validate all the volumes and binds <del> if err := validateVolumesAndBindSettings(w.Config, hc); err != nil { <add> if err := validateMountSettings(w.Config, hc); err != nil { <ide> return nil, nil, nil, err <ide> } <ide> } <ide> func DecodeContainerConfig(src io.Reader) (*container.Config, *container.HostCon <ide> return w.Config, hc, w.NetworkingConfig, nil <ide> } <ide> <del>// validateVolumesAndBindSettings validates each of the volumes and bind settings <add>// validateMountSettings validates each of the volumes and bind settings <ide> // passed by the caller to ensure they are valid. <del>func validateVolumesAndBindSettings(c *container.Config, hc *container.HostConfig) error { <del> if len(hc.Mounts) > 0 { <del> if len(hc.Binds) > 0 { <del> return conflictError(fmt.Errorf("must not specify both Binds and Mounts")) <del> } <del> <del> if len(c.Volumes) > 0 { <del> return conflictError(fmt.Errorf("must not specify both Volumes and Mounts")) <del> } <del> <del> if len(hc.VolumeDriver) > 0 { <del> return conflictError(fmt.Errorf("must not specify both VolumeDriver and Mounts")) <del> } <del> } <add>func validateMountSettings(c *container.Config, hc *container.HostConfig) error { <add> // it is ok to have len(hc.Mounts) > 0 && (len(hc.Binds) > 0 || len (c.Volumes) > 0 || len (hc.Tmpfs) > 0 ) <ide> <ide> // Ensure all volumes and binds are valid. <ide> for spec := range c.Volumes { <ide><path>volume/validate.go <ide> func validateMountConfig(mnt *mount.Mount, options ...func(*validateOpts)) error <ide> return &errMountConfig{mnt, err} <ide> } <ide> } <add> case mount.TypeTmpfs: <add> if len(mnt.Source) != 0 { <add> return &errMountConfig{mnt, errExtraField("Source")} <add> } <add> if _, err := ConvertTmpfsOptions(mnt.TmpfsOptions); err != nil { <add> return &errMountConfig{mnt, err} <add> } <ide> default: <ide> return &errMountConfig{mnt, errors.New("mount type unknown")} <ide> } <ide><path>volume/volume.go <ide> func ParseMountSpec(cfg mounttypes.Mount, options ...func(*validateOpts)) (*Moun <ide> mp.Propagation = cfg.BindOptions.Propagation <ide> } <ide> } <add> case mounttypes.TypeTmpfs: <add> // NOP <ide> } <ide> return mp, nil <ide> } <ide><path>volume/volume_linux.go <add>// +build linux <add> <add>package volume <add> <add>import ( <add> "fmt" <add> "strings" <add> <add> mounttypes "github.com/docker/docker/api/types/mount" <add>) <add> <add>// ConvertTmpfsOptions converts *mounttypes.TmpfsOptions to the raw option string <add>// for mount(2). <add>// The logic is copy-pasted from daemon/cluster/executer/container.getMountMask. <add>// It will be deduplicated when we migrated the cluster to the new mount scheme. <add>func ConvertTmpfsOptions(opt *mounttypes.TmpfsOptions) (string, error) { <add> if opt == nil { <add> return "", nil <add> } <add> var rawOpts []string <add> if opt.Mode != 0 { <add> rawOpts = append(rawOpts, fmt.Sprintf("mode=%o", opt.Mode)) <add> } <add> <add> if opt.SizeBytes != 0 { <add> // calculate suffix here, making this linux specific, but that is <add> // okay, since API is that way anyways. <add> <add> // we do this by finding the suffix that divides evenly into the <add> // value, returing the value itself, with no suffix, if it fails. <add> // <add> // For the most part, we don't enforce any semantic to this values. <add> // The operating system will usually align this and enforce minimum <add> // and maximums. <add> var ( <add> size = opt.SizeBytes <add> suffix string <add> ) <add> for _, r := range []struct { <add> suffix string <add> divisor int64 <add> }{ <add> {"g", 1 << 30}, <add> {"m", 1 << 20}, <add> {"k", 1 << 10}, <add> } { <add> if size%r.divisor == 0 { <add> size = size / r.divisor <add> suffix = r.suffix <add> break <add> } <add> } <add> <add> rawOpts = append(rawOpts, fmt.Sprintf("size=%d%s", size, suffix)) <add> } <add> return strings.Join(rawOpts, ","), nil <add>} <ide><path>volume/volume_linux_test.go <add>// +build linux <add> <add>package volume <add> <add>import ( <add> "testing" <add> <add> mounttypes "github.com/docker/docker/api/types/mount" <add>) <add> <add>func TestConvertTmpfsOptions(t *testing.T) { <add> type testCase struct { <add> opt mounttypes.TmpfsOptions <add> } <add> cases := []testCase{ <add> {mounttypes.TmpfsOptions{SizeBytes: 1024 * 1024, Mode: 0700}}, <add> } <add> for _, c := range cases { <add> if _, err := ConvertTmpfsOptions(&c.opt); err != nil { <add> t.Fatalf("could not convert %+v to string: %v", c.opt, err) <add> } <add> } <add>} <ide><path>volume/volume_unsupported.go <add>// +build !linux <add> <add>package volume <add> <add>import ( <add> "fmt" <add> "runtime" <add> <add> mounttypes "github.com/docker/docker/api/types/mount" <add>) <add> <add>// ConvertTmpfsOptions converts *mounttypes.TmpfsOptions to the raw option string <add>// for mount(2). <add>func ConvertTmpfsOptions(opt *mounttypes.TmpfsOptions) (string, error) { <add> return "", fmt.Errorf("%s does not support tmpfs", runtime.GOOS) <add>}
14
Python
Python
move db call out of __init__
f0e24218077d4dff8015926d7826477bb0d07f88
<ide><path>airflow/providers/microsoft/azure/hooks/azure_cosmos.py <ide> """ <ide> import uuid <ide> <del>import azure.cosmos.cosmos_client as cosmos_client <add>from azure.cosmos.cosmos_client import CosmosClient <ide> from azure.cosmos.errors import HTTPFailure <ide> <ide> from airflow.exceptions import AirflowBadRequest <ide> class AzureCosmosDBHook(BaseHook): <ide> <ide> def __init__(self, azure_cosmos_conn_id='azure_cosmos_default'): <ide> self.conn_id = azure_cosmos_conn_id <del> self.connection = self.get_connection(self.conn_id) <del> self.extras = self.connection.extra_dejson <add> self._conn = None <ide> <del> self.endpoint_uri = self.connection.login <del> self.master_key = self.connection.password <del> self.default_database_name = self.extras.get('database_name') <del> self.default_collection_name = self.extras.get('collection_name') <del> self.cosmos_client = None <add> self.default_database_name = None <add> self.default_collection_name = None <ide> <ide> def get_conn(self): <ide> """ <ide> Return a cosmos db client. <ide> """ <del> if self.cosmos_client is not None: <del> return self.cosmos_client <add> if not self._conn: <add> conn = self.get_connection(self.conn_id) <add> extras = conn.extra_dejson <add> endpoint_uri = conn.login <add> master_key = conn.password <ide> <del> # Initialize the Python Azure Cosmos DB client <del> self.cosmos_client = cosmos_client.CosmosClient(self.endpoint_uri, {'masterKey': self.master_key}) <add> self.default_database_name = extras.get('database_name') <add> self.default_collection_name = extras.get('collection_name') <ide> <del> return self.cosmos_client <add> # Initialize the Python Azure Cosmos DB client <add> self._conn = CosmosClient(endpoint_uri, {'masterKey': master_key}) <add> return self._conn <ide> <ide> def __get_database_name(self, database_name=None): <add> self.get_conn() <ide> db_name = database_name <ide> if db_name is None: <ide> db_name = self.default_database_name <ide> def __get_database_name(self, database_name=None): <ide> return db_name <ide> <ide> def __get_collection_name(self, collection_name=None): <add> self.get_conn() <ide> coll_name = collection_name <ide> if coll_name is None: <ide> coll_name = self.default_collection_name <ide><path>tests/providers/microsoft/azure/hooks/test_azure_cosmos.py <ide> import uuid <ide> <ide> import mock <add>from azure.cosmos.cosmos_client import CosmosClient <ide> <ide> from airflow.exceptions import AirflowException <ide> from airflow.models import Connection <ide> def setUp(self): <ide> ) <ide> ) <ide> <del> @mock.patch('azure.cosmos.cosmos_client.CosmosClient') <add> @mock.patch('airflow.providers.microsoft.azure.hooks.azure_cosmos.CosmosClient', autospec=True) <add> def test_client(self, mock_cosmos): <add> hook = AzureCosmosDBHook(azure_cosmos_conn_id='azure_cosmos_test_key_id') <add> self.assertIsNone(hook._conn) <add> self.assertIsInstance(hook.get_conn(), CosmosClient) <add> <add> @mock.patch('airflow.providers.microsoft.azure.hooks.azure_cosmos.CosmosClient') <ide> def test_create_database(self, mock_cosmos): <ide> hook = AzureCosmosDBHook(azure_cosmos_conn_id='azure_cosmos_test_key_id') <ide> hook.create_database(self.test_database_name) <ide> expected_calls = [mock.call().CreateDatabase({'id': self.test_database_name})] <ide> mock_cosmos.assert_any_call(self.test_end_point, {'masterKey': self.test_master_key}) <ide> mock_cosmos.assert_has_calls(expected_calls) <ide> <del> @mock.patch('azure.cosmos.cosmos_client.CosmosClient') <add> @mock.patch('airflow.providers.microsoft.azure.hooks.azure_cosmos.CosmosClient') <ide> def test_create_database_exception(self, mock_cosmos): <ide> hook = AzureCosmosDBHook(azure_cosmos_conn_id='azure_cosmos_test_key_id') <ide> self.assertRaises(AirflowException, hook.create_database, None) <ide> <del> @mock.patch('azure.cosmos.cosmos_client.CosmosClient') <add> @mock.patch('airflow.providers.microsoft.azure.hooks.azure_cosmos.CosmosClient') <ide> def test_create_container_exception(self, mock_cosmos): <ide> hook = AzureCosmosDBHook(azure_cosmos_conn_id='azure_cosmos_test_key_id') <ide> self.assertRaises(AirflowException, hook.create_collection, None) <ide> <del> @mock.patch('azure.cosmos.cosmos_client.CosmosClient') <add> @mock.patch('airflow.providers.microsoft.azure.hooks.azure_cosmos.CosmosClient') <ide> def test_create_container(self, mock_cosmos): <ide> hook = AzureCosmosDBHook(azure_cosmos_conn_id='azure_cosmos_test_key_id') <ide> hook.create_collection(self.test_collection_name, self.test_database_name) <ide> def test_create_container(self, mock_cosmos): <ide> mock_cosmos.assert_any_call(self.test_end_point, {'masterKey': self.test_master_key}) <ide> mock_cosmos.assert_has_calls(expected_calls) <ide> <del> @mock.patch('azure.cosmos.cosmos_client.CosmosClient') <add> @mock.patch('airflow.providers.microsoft.azure.hooks.azure_cosmos.CosmosClient') <ide> def test_create_container_default(self, mock_cosmos): <ide> hook = AzureCosmosDBHook(azure_cosmos_conn_id='azure_cosmos_test_key_id') <ide> hook.create_collection(self.test_collection_name) <ide> def test_create_container_default(self, mock_cosmos): <ide> mock_cosmos.assert_any_call(self.test_end_point, {'masterKey': self.test_master_key}) <ide> mock_cosmos.assert_has_calls(expected_calls) <ide> <del> @mock.patch('azure.cosmos.cosmos_client.CosmosClient') <add> @mock.patch('airflow.providers.microsoft.azure.hooks.azure_cosmos.CosmosClient') <ide> def test_upsert_document_default(self, mock_cosmos): <ide> test_id = str(uuid.uuid4()) <ide> mock_cosmos.return_value.CreateItem.return_value = {'id': test_id} <ide> def test_upsert_document_default(self, mock_cosmos): <ide> logging.getLogger().info(returned_item) <ide> self.assertEqual(returned_item['id'], test_id) <ide> <del> @mock.patch('azure.cosmos.cosmos_client.CosmosClient') <add> @mock.patch('airflow.providers.microsoft.azure.hooks.azure_cosmos.CosmosClient') <ide> def test_upsert_document(self, mock_cosmos): <ide> test_id = str(uuid.uuid4()) <ide> mock_cosmos.return_value.CreateItem.return_value = {'id': test_id} <ide> def test_upsert_document(self, mock_cosmos): <ide> logging.getLogger().info(returned_item) <ide> self.assertEqual(returned_item['id'], test_id) <ide> <del> @mock.patch('azure.cosmos.cosmos_client.CosmosClient') <add> @mock.patch('airflow.providers.microsoft.azure.hooks.azure_cosmos.CosmosClient') <ide> def test_insert_documents(self, mock_cosmos): <ide> test_id1 = str(uuid.uuid4()) <ide> test_id2 = str(uuid.uuid4()) <ide> def test_insert_documents(self, mock_cosmos): <ide> {'data': 'data3', 'id': test_id3})] <ide> logging.getLogger().info(returned_item) <ide> mock_cosmos.assert_any_call(self.test_end_point, {'masterKey': self.test_master_key}) <del> mock_cosmos.assert_has_calls(expected_calls) <add> mock_cosmos.assert_has_calls(expected_calls, any_order=True) <ide> <del> @mock.patch('azure.cosmos.cosmos_client.CosmosClient') <add> @mock.patch('airflow.providers.microsoft.azure.hooks.azure_cosmos.CosmosClient') <ide> def test_delete_database(self, mock_cosmos): <ide> hook = AzureCosmosDBHook(azure_cosmos_conn_id='azure_cosmos_test_key_id') <ide> hook.delete_database(self.test_database_name) <ide> expected_calls = [mock.call().DeleteDatabase('dbs/test_database_name')] <ide> mock_cosmos.assert_any_call(self.test_end_point, {'masterKey': self.test_master_key}) <ide> mock_cosmos.assert_has_calls(expected_calls) <ide> <del> @mock.patch('azure.cosmos.cosmos_client.CosmosClient') <add> @mock.patch('airflow.providers.microsoft.azure.hooks.azure_cosmos.CosmosClient') <ide> def test_delete_database_exception(self, mock_cosmos): <ide> hook = AzureCosmosDBHook(azure_cosmos_conn_id='azure_cosmos_test_key_id') <ide> self.assertRaises(AirflowException, hook.delete_database, None) <ide> def test_delete_container_exception(self, mock_cosmos): <ide> hook = AzureCosmosDBHook(azure_cosmos_conn_id='azure_cosmos_test_key_id') <ide> self.assertRaises(AirflowException, hook.delete_collection, None) <ide> <del> @mock.patch('azure.cosmos.cosmos_client.CosmosClient') <add> @mock.patch('airflow.providers.microsoft.azure.hooks.azure_cosmos.CosmosClient') <ide> def test_delete_container(self, mock_cosmos): <ide> hook = AzureCosmosDBHook(azure_cosmos_conn_id='azure_cosmos_test_key_id') <ide> hook.delete_collection(self.test_collection_name, self.test_database_name) <ide> expected_calls = [mock.call().DeleteContainer('dbs/test_database_name/colls/test_collection_name')] <ide> mock_cosmos.assert_any_call(self.test_end_point, {'masterKey': self.test_master_key}) <ide> mock_cosmos.assert_has_calls(expected_calls) <ide> <del> @mock.patch('azure.cosmos.cosmos_client.CosmosClient') <add> @mock.patch('airflow.providers.microsoft.azure.hooks.azure_cosmos.CosmosClient') <ide> def test_delete_container_default(self, mock_cosmos): <ide> hook = AzureCosmosDBHook(azure_cosmos_conn_id='azure_cosmos_test_key_id') <ide> hook.delete_collection(self.test_collection_name) <ide><path>tests/providers/microsoft/azure/operators/test_azure_cosmos.py <ide> def setUp(self): <ide> ) <ide> ) <ide> <del> @mock.patch('azure.cosmos.cosmos_client.CosmosClient') <add> @mock.patch('airflow.providers.microsoft.azure.hooks.azure_cosmos.CosmosClient') <ide> def test_insert_document(self, cosmos_mock): <ide> test_id = str(uuid.uuid4()) <ide> cosmos_mock.return_value.CreateItem.return_value = {'id': test_id}
3
Java
Java
fix multipart request test with jetty server
8b5f5d9f653d0656787e285065f5bdd66fc9427e
<ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartIntegrationTests.java <ide> public void standardMultipartResolver() throws Exception { <ide> <ide> @Test // SPR-13319 <ide> public void standardMultipartResolverWithEncodedFileName() throws Exception { <del> byte[] boundary = MimeTypeUtils.generateMultipartBoundary(); <del> String boundaryText = new String(boundary, "US-ASCII"); <add> String boundaryText = MimeTypeUtils.generateMultipartBoundaryString(); <ide> Map<String, String> params = Collections.singletonMap("boundary", boundaryText); <ide> <ide> String content = <del> "--" + boundaryText + "\n" + <del> "Content-Disposition: form-data; name=\"file\"; filename*=\"utf-8''%C3%A9l%C3%A8ve.txt\"\n" + <del> "Content-Type: text/plain\n" + <del> "Content-Length: 7\n" + <del> "\n" + <del> "content\n" + <add> "--" + boundaryText + "\r\n" + <add> "Content-Disposition: form-data; name=\"file\"; filename*=\"utf-8''%C3%A9l%C3%A8ve.txt\"\r\n" + <add> "Content-Type: text/plain\r\n" + <add> "Content-Length: 7\r\n" + <add> "\r\n" + <add> "content\r\n" + <ide> "--" + boundaryText + "--"; <ide> <ide> RequestEntity<byte[]> requestEntity =
1
Python
Python
remove deprecated assertequals
37709b59099bd984858ca1884c6c70403420347d
<ide><path>tests/test_tokenization_fast.py <ide> def assert_embeded_special_tokens(self, tokenizer_r, tokenizer_p): <ide> self.assertSequenceEqual(tokens_p["input_ids"], [0, 250, 6, 50264, 3823, 487, 21992, 3645, 4, 2]) <ide> <ide> # token_type_ids should put 0 everywhere <del> self.assertEquals(sum(tokens_r["token_type_ids"]), sum(tokens_p["token_type_ids"])) <add> self.assertEqual(sum(tokens_r["token_type_ids"]), sum(tokens_p["token_type_ids"])) <ide> <ide> # attention_mask should put 1 everywhere, so sum over length should be 1 <del> self.assertEquals( <add> self.assertEqual( <ide> sum(tokens_r["attention_mask"]) / len(tokens_r["attention_mask"]), <ide> sum(tokens_p["attention_mask"]) / len(tokens_p["attention_mask"]), <ide> )
1
Javascript
Javascript
add test for stream unpipe with 'data' listeners
ee67dd0a47b2fd5c1dd062349bdfccd5e2e0681a
<ide><path>test/parallel/test-stream-pipe-flow-after-unpipe.js <add>'use strict'; <add>const common = require('../common'); <add>const { Readable, Writable } = require('stream'); <add> <add>// Tests that calling .unpipe() un-blocks a stream that is paused because <add>// it is waiting on the writable side to finish a write(). <add> <add>const rs = new Readable({ <add> highWaterMark: 1, <add> // That this gets called at least 20 times is the real test here. <add> read: common.mustCallAtLeast(() => rs.push('foo'), 20) <add>}); <add> <add>const ws = new Writable({ <add> highWaterMark: 1, <add> write: common.mustCall(() => { <add> // Ignore the callback, this write() simply never finishes. <add> setImmediate(() => rs.unpipe(ws)); <add> }) <add>}); <add> <add>let chunks = 0; <add>rs.on('data', common.mustCallAtLeast(() => { <add> chunks++; <add> if (chunks >= 20) <add> rs.pause(); // Finish this test. <add>})); <add> <add>rs.pipe(ws);
1
Python
Python
add unittests for celery.datastructures
6392bee2de2ccd442884aeeaa089f1840e17db77
<ide><path>celery/tests/test_datastructures.py <add>import unittest <add>import sys <add> <add>from celery.datastructures import PositionQueue, ExceptionInfo <add> <add> <add>class TestPositionQueue(unittest.TestCase): <add> <add> def test_position_queue_unfilled(self): <add> q = PositionQueue(length=10) <add> for position in q.data: <add> self.assertTrue(isinstance(position, q.UnfilledPosition)) <add> <add> self.assertEquals(q.filled, []) <add> self.assertEquals(len(q), 0) <add> self.assertFalse(q.full()) <add> <add> def test_position_queue_almost(self): <add> q = PositionQueue(length=10) <add> q[3] = 3 <add> q[6] = 6 <add> q[9] = 9 <add> <add> self.assertEquals(q.filled, [3, 6, 9]) <add> self.assertEquals(len(q), 3) <add> self.assertFalse(q.full()) <add> <add> def test_position_queue_full(self): <add> q = PositionQueue(length=10) <add> for i in xrange(10): <add> q[i] = i <add> self.assertEquals(q.filled, list(xrange(10))) <add> self.assertEquals(len(q), 10) <add> self.assertTrue(q.full()) <add> <add> <add>class TestExceptionInfo(unittest.TestCase): <add> <add> def test_exception_info(self): <add> <add> try: <add> raise LookupError("The quick brown fox jumps...") <add> except LookupError: <add> exc_info = sys.exc_info() <add> <add> einfo = ExceptionInfo(exc_info) <add> self.assertEquals(str(einfo), "The quick brown fox jumps...") <add> self.assertTrue(isinstance(einfo.exception, LookupError)) <add> self.assertEquals(einfo.exception.args, <add> ("The quick brown fox jumps...", )) <add> self.assertTrue(einfo.traceback)
1
PHP
PHP
use assertfileexists
cabb61012f67c4a1ad9278dc88ce47b710dbe9d3
<ide><path>tests/Filesystem/FilesystemTest.php <ide> public function testCopyCopiesFileProperly() <ide> mkdir($this->tempDir.'/foo'); <ide> file_put_contents($this->tempDir.'/foo/foo.txt', $data); <ide> $filesystem->copy($this->tempDir.'/foo/foo.txt', $this->tempDir.'/foo/foo2.txt'); <del> $this->assertTrue(file_exists($this->tempDir.'/foo/foo2.txt')); <add> $this->assertFileExists($this->tempDir.'/foo/foo2.txt'); <ide> $this->assertEquals($data, file_get_contents($this->tempDir.'/foo/foo2.txt')); <ide> } <ide>
1
PHP
PHP
remove redundant code
d45c5bc6cfaea63fc6a470119027cf1711dd7a93
<ide><path>tests/TestCase/Datasource/ConnectionManagerTest.php <ide> */ <ide> namespace Cake\Test\TestCase\Datasource; <ide> <del>use Cake\Core\Plugin; <ide> use Cake\Datasource\ConnectionManager; <ide> use Cake\TestSuite\TestCase; <ide> <ide> public function tearDown() <ide> { <ide> parent::tearDown(); <ide> $this->clearPlugins(); <del> Plugin::getCollection()->clear(); <ide> ConnectionManager::drop('test_variant'); <ide> ConnectionManager::dropAlias('other_name'); <ide> }
1
Ruby
Ruby
run actionpack test cases in random order
dad40bf9eae66413eb4ef6cf432cd80aaacfaeda
<ide><path>actionpack/test/abstract_unit.rb <ide> def translate_exceptions(result) <ide> # Use N processes (N defaults to 4) <ide> Minitest.parallel_executor = ForkingExecutor.new(PROCESS_COUNT) <ide> end <del> <del># FIXME: we have tests that depend on run order, we should fix that and <del># remove this method call. <del>require 'active_support/test_case' <del>ActiveSupport::TestCase.test_order = :sorted
1
Javascript
Javascript
ignore nan in d3.scale.quantile
bfed47b9d9531398c5645075829e6e14f32afe65
<ide><path>d3.js <del>d3 = {version: "0.28.5"}; // semver <add>d3 = {version: "0.28.6"}; // semver <ide> if (!Date.now) Date.now = function() { <ide> return +new Date(); <ide> }; <ide> d3.scale.quantile = function() { <ide> <ide> scale.domain = function(x) { <ide> if (!arguments.length) return domain; <del> domain = x.slice().sort(d3.ascending); <add> domain = x.filter(function(d) { return !isNaN(d); }).sort(d3.ascending); <ide> rescale(); <ide> return scale; <ide> }; <ide> d3.scale.quantile = function() { <ide> return scale; <ide> }; <ide> <add> scale.quantiles = function() { <add> return thresholds; <add> }; <add> <ide> return scale; <ide> }; <ide> d3.svg = {}; <ide><path>d3.min.js <del>(function(){var o=null;d3={version:"0.28.5"};if(!Date.now)Date.now=function(){return+new Date};if(!Object.create)Object.create=function(a){function b(){}b.prototype=a;return new b};function x(a){return Array.prototype.slice.call(a)}function y(a){return typeof a=="function"?a:function(){return a}}d3.ascending=function(a,b){return a<b?-1:a>b?1:0};d3.descending=function(a,b){return b<a?-1:b>a?1:0};d3.merge=function(a){return Array.prototype.concat.apply([],a)}; <add>(function(){var o=null;d3={version:"0.28.6"};if(!Date.now)Date.now=function(){return+new Date};if(!Object.create)Object.create=function(a){function b(){}b.prototype=a;return new b};function x(a){return Array.prototype.slice.call(a)}function y(a){return typeof a=="function"?a:function(){return a}}d3.ascending=function(a,b){return a<b?-1:a>b?1:0};d3.descending=function(a,b){return b<a?-1:b>a?1:0};d3.merge=function(a){return Array.prototype.concat.apply([],a)}; <ide> d3.split=function(a,b){var c=[],f=[],d,e=-1,h=a.length;if(arguments.length<2)b=aa;for(;++e<h;)if(b.call(f,d=a[e],e)){c.push(f);f=[]}else f.push(d);c.push(f);return c};function aa(a){return a==o}function E(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function ba(a,b){b=x(arguments);b[0]=this;a.apply(this,b);return this} <ide> d3.range=function(a,b,c){if(arguments.length==1){b=a;a=0}if(c==o)c=1;if((b-a)/c==Infinity)throw Error("infinite range");var f=[],d=-1,e;if(c<0)for(;(e=a+c*++d)>b;)f.push(e);else for(;(e=a+c*++d)<b;)f.push(e);return f};d3.requote=function(a){return a.replace(ca,"\\$&")};var ca=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g; <ide> d3.xhr=function(a,b,c){var f=new XMLHttpRequest;if(arguments.length<3)c=b;else b&&f.overrideMimeType(b);f.open("GET",a,true);f.onreadystatechange=function(){if(f.readyState==4)c(f.status<300?f:o)};f.send(o)};d3.text=function(a,b,c){if(arguments.length<3){c=b;b=o}d3.xhr(a,b,function(f){c(f&&f.responseText)})};d3.json=function(a,b){d3.text(a,"application/json",function(c){b(c?JSON.parse(c):o)})}; <ide> d3.scale.ordinal=function(){function a(e){e=e in c?c[e]:c[e]=b.push(e)-1;return <ide> 2)h=0;var g=e[0],i=e[1],j=(i-g)/(b.length+h);f=d3.range(g+j*h,i,j);d=j*(1-h);return a};a.rangeBand=function(){return d};return a};d3.scale.category10=function(){return d3.scale.ordinal().range(Ea)};d3.scale.category20=function(){return d3.scale.ordinal().range(Fa)};d3.scale.category20b=function(){return d3.scale.ordinal().range(Ha)};d3.scale.category20c=function(){return d3.scale.ordinal().range(Ia)}; <ide> var Ea=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Fa=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],Ha=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd", <ide> "#de9ed6"],Ia=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"]; <del>d3.scale.quantile=function(){function a(){for(var h=-1,g=e.length=d.length,i=f.length/g;++h<g;)e[h]=f[~~(h*i)]}function b(h){if(isNaN(h=+h))return NaN;for(var g=0,i=e.length-1;g<=i;){var j=g+i>>1,l=e[j];if(l<h)g=j+1;else if(l>h)i=j-1;else return j}return i<0?0:i}function c(h){return d[b(h)]}var f=[],d=[],e=[];c.domain=function(h){if(!arguments.length)return f;f=h.slice().sort(d3.ascending);a();return c};c.range=function(h){if(!arguments.length)return d;d=h;a();return c};return c};d3.svg={}; <add>d3.scale.quantile=function(){function a(){for(var h=-1,g=e.length=d.length,i=f.length/g;++h<g;)e[h]=f[~~(h*i)]}function b(h){if(isNaN(h=+h))return NaN;for(var g=0,i=e.length-1;g<=i;){var j=g+i>>1,l=e[j];if(l<h)g=j+1;else if(l>h)i=j-1;else return j}return i<0?0:i}function c(h){return d[b(h)]}var f=[],d=[],e=[];c.domain=function(h){if(!arguments.length)return f;f=h.filter(function(g){return!isNaN(g)}).sort(d3.ascending);a();return c};c.range=function(h){if(!arguments.length)return d;d=h;a();return c}; <add>c.u=function(){return e};return c};d3.svg={}; <ide> d3.svg.arc=function(){function a(e,h){var g=b.call(this,e,h),i=c.call(this,e,h),j=f.call(this,e,h)+V,l=d.call(this,e,h)+V,p=l-j,q=p<Math.PI?"0":"1",k=Math.cos(j);j=Math.sin(j);var n=Math.cos(l);l=Math.sin(l);return p>=2*Math.PI?g?"M0,"+i+"A"+i+","+i+" 0 1,1 0,"+-i+"A"+i+","+i+" 0 1,1 0,"+i+"M0,"+g+"A"+g+","+g+" 0 1,1 0,"+-g+"A"+g+","+g+" 0 1,1 0,"+g+"Z":"M0,"+i+"A"+i+","+i+" 0 1,1 0,"+-i+"A"+i+","+i+" 0 1,1 0,"+i+"Z":g?"M"+i*k+","+i*j+"A"+i+","+i+" 0 "+q+",1 "+i*n+","+i*l+"L"+g*n+","+g*l+"A"+g+","+ <ide> g+" 0 "+q+",0 "+g*k+","+g*j+"Z":"M"+i*k+","+i*j+"A"+i+","+i+" 0 "+q+",1 "+i*n+","+i*l+"L0,0Z"}var b=Ja,c=Ka,f=La,d=Ma;a.innerRadius=function(e){if(!arguments.length)return b;b=y(e);return a};a.outerRadius=function(e){if(!arguments.length)return c;c=y(e);return a};a.startAngle=function(e){if(!arguments.length)return f;f=y(e);return a};a.endAngle=function(e){if(!arguments.length)return d;d=y(e);return a};return a};var V=-Math.PI/2;function Ja(a){return a.innerRadius} <ide> function Ka(a){return a.outerRadius}function La(a){return a.startAngle}function Ma(a){return a.endAngle}d3.svg.line=function(){function a(e){return e.length<1?o:"M"+d(W(this,e,b,c))}var b=Na,c=Oa,f="linear",d=X[f];a.x=function(e){if(!arguments.length)return b;b=e;return a};a.y=function(e){if(!arguments.length)return c;c=e;return a};a.interpolate=function(e){if(!arguments.length)return f;d=X[f=e];return a};return a}; <ide><path>src/core/core.js <del>d3 = {version: "0.28.5"}; // semver <add>d3 = {version: "0.28.6"}; // semver <ide><path>src/scale/quantile.js <ide> d3.scale.quantile = function() { <ide> <ide> scale.domain = function(x) { <ide> if (!arguments.length) return domain; <del> domain = x.slice().sort(d3.ascending); <add> domain = x.filter(function(d) { return !isNaN(d); }).sort(d3.ascending); <ide> rescale(); <ide> return scale; <ide> }; <ide> d3.scale.quantile = function() { <ide> return scale; <ide> }; <ide> <add> scale.quantiles = function() { <add> return thresholds; <add> }; <add> <ide> return scale; <ide> };
4
Javascript
Javascript
add the bloomberg app to the showcase
45bccef20df389aff1398d7a81a56e95b4c293c4
<ide><path>website/src/react-native/showcase.js <ide> var featured = [ <ide> linkAppStore: 'http://apple.co/2dfkYH9', <ide> infoLink: 'https://blog.getchop.io/how-we-built-chop-bae3d8acd131#.7y8buamrq', <ide> infoTitle: 'How we built Chop', <add> }, <add> { <add> name: 'Bloomberg', <add> icon: 'http://is1.mzstatic.com/image/thumb/Purple71/v4/31/24/72/312472df-3d53-0acf-fc31-8a25682e528f/source/175x175bb.jpg', <add> linkAppStore: 'https://itunes.apple.com/us/app/bloomberg/id281941097?mt=8', <add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.bloomberg.android.plus&hl=en', <add> infoLink: 'https://www.techatbloomberg.com/blog/bloomberg-used-react-native-develop-new-consumer-app/', <add> infoTitle: 'How Bloomberg Used React Native to Develop its new Consumer App', <ide> } <ide> ]; <ide>
1
Javascript
Javascript
remove unused branches
c00d08f5ec874de5e9b7c969d71117d32340e270
<ide><path>lib/fs.js <ide> function writeAll(fd, isUserFd, buffer, offset, length, position, callback_) { <ide> fs.write(fd, buffer, offset, length, position, function(writeErr, written) { <ide> if (writeErr) { <ide> if (isUserFd) { <del> if (callback) callback(writeErr); <add> callback(writeErr); <ide> } else { <ide> fs.close(fd, function() { <del> if (callback) callback(writeErr); <add> callback(writeErr); <ide> }); <ide> } <ide> } else { <ide> if (written === length) { <ide> if (isUserFd) { <del> if (callback) callback(null); <add> callback(null); <ide> } else { <ide> fs.close(fd, callback); <ide> } <ide> fs.writeFile = function(path, data, options, callback_) { <ide> <ide> fs.open(path, flag, options.mode, function(openErr, fd) { <ide> if (openErr) { <del> if (callback) callback(openErr); <add> callback(openErr); <ide> } else { <ide> writeFd(fd, false); <ide> }
1
Javascript
Javascript
fix use of reserved keyword as a parameter name
2ddd5ff88c041042826f45382623bf4fc94db320
<ide><path>src/platforms/platform.dom.js <ide> module.exports = function(Chart) { <ide> return canvas; <ide> } <ide> <del> function createEvent(type, chart, x, y, native) { <add> function createEvent(type, chart, x, y, nativeEvent) { <ide> return { <ide> type: type, <ide> chart: chart, <del> native: native || null, <add> native: nativeEvent || null, <ide> x: x !== undefined? x : null, <ide> y: y !== undefined? y : null, <ide> };
1
Ruby
Ruby
organize relation methods into separate modules
7aabaac0f5ba108f917af2c65a79511694393b85
<ide><path>activerecord/lib/active_record.rb <ide> module ActiveRecord <ide> autoload :AttributeMethods <ide> autoload :Attributes <ide> autoload :AutosaveAssociation <add> <ide> autoload :Relation <del> autoload :RelationalCalculations <add> <add> autoload_under 'relation' do <add> autoload :QueryMethods <add> autoload :FinderMethods <add> autoload :CalculationMethods <add> end <add> <ide> autoload :Base <ide> autoload :Batches <ide> autoload :Calculations <ide><path>activerecord/lib/active_record/relation.rb <ide> module ActiveRecord <ide> class Relation <del> include RelationalCalculations <add> include QueryMethods, FinderMethods, CalculationMethods <ide> <ide> delegate :to_sql, :to => :relation <ide> delegate :length, :collect, :map, :each, :all?, :to => :to_a <ide> def merge(r) <ide> <ide> alias :& :merge <ide> <del> def preload(*associations) <del> spawn.tap {|r| r.preload_associations += Array.wrap(associations) } <del> end <del> <del> def eager_load(*associations) <del> spawn.tap {|r| r.eager_load_associations += Array.wrap(associations) } <del> end <del> <del> def readonly(status = true) <del> spawn.tap {|r| r.readonly = status } <del> end <del> <del> def select(selects) <del> if selects.present? <del> relation = spawn(@relation.project(selects)) <del> relation.readonly = @relation.joins(relation).present? ? false : @readonly <del> relation <del> else <del> spawn <del> end <del> end <del> <del> def from(from) <del> from.present? ? spawn(@relation.from(from)) : spawn <del> end <del> <del> def having(*args) <del> return spawn if args.blank? <del> <del> if [String, Hash, Array].include?(args.first.class) <del> havings = @klass.send(:merge_conditions, args.size > 1 ? Array.wrap(args) : args.first) <del> else <del> havings = args.first <del> end <del> <del> spawn(@relation.having(havings)) <del> end <del> <del> def group(groups) <del> groups.present? ? spawn(@relation.group(groups)) : spawn <del> end <del> <del> def order(orders) <del> orders.present? ? spawn(@relation.order(orders)) : spawn <del> end <del> <del> def lock(locks = true) <del> case locks <del> when String <del> spawn(@relation.lock(locks)) <del> when TrueClass, NilClass <del> spawn(@relation.lock) <del> else <del> spawn <del> end <del> end <del> <del> def reverse_order <del> relation = spawn <del> relation.instance_variable_set(:@orders, nil) <del> <del> order_clause = @relation.send(:order_clauses).join(', ') <del> if order_clause.present? <del> relation.order(reverse_sql_order(order_clause)) <del> else <del> relation.order("#{@klass.table_name}.#{@klass.primary_key} DESC") <del> end <del> end <del> <del> def limit(limits) <del> limits.present? ? spawn(@relation.take(limits)) : spawn <del> end <del> <del> def offset(offsets) <del> offsets.present? ? spawn(@relation.skip(offsets)) : spawn <del> end <del> <del> def on(join) <del> spawn(@relation.on(join)) <del> end <del> <del> def joins(join, join_type = nil) <del> return spawn if join.blank? <del> <del> join_relation = case join <del> when String <del> @relation.join(join) <del> when Hash, Array, Symbol <del> if @klass.send(:array_of_strings?, join) <del> @relation.join(join.join(' ')) <del> else <del> @relation.join(@klass.send(:build_association_joins, join)) <del> end <del> else <del> @relation.join(join, join_type) <del> end <del> <del> spawn(join_relation).tap { |r| r.readonly = true } <del> end <del> <del> def where(*args) <del> return spawn if args.blank? <del> <del> if [String, Hash, Array].include?(args.first.class) <del> conditions = @klass.send(:merge_conditions, args.size > 1 ? Array.wrap(args) : args.first) <del> conditions = Arel::SqlLiteral.new(conditions) if conditions <del> else <del> conditions = args.first <del> end <del> <del> spawn(@relation.where(conditions)) <del> end <del> <ide> def respond_to?(method, include_private = false) <ide> return true if @relation.respond_to?(method, include_private) || Array.method_defined?(method) <ide> <ide> def to_a <ide> <ide> alias all to_a <ide> <del> def find(*ids, &block) <del> return to_a.find(&block) if block_given? <del> <del> expects_array = ids.first.kind_of?(Array) <del> return ids.first if expects_array && ids.first.empty? <del> <del> ids = ids.flatten.compact.uniq <del> <del> case ids.size <del> when 0 <del> raise RecordNotFound, "Couldn't find #{@klass.name} without an ID" <del> when 1 <del> result = find_one(ids.first) <del> expects_array ? [ result ] : result <del> else <del> find_some(ids) <del> end <del> end <del> <del> def exists?(id = nil) <del> relation = select("#{@klass.quoted_table_name}.#{@klass.primary_key}").limit(1) <del> relation = relation.where(@klass.primary_key => id) if id <del> relation.first ? true : false <del> end <del> <del> def first <del> if loaded? <del> @records.first <del> else <del> @first ||= limit(1).to_a[0] <del> end <del> end <del> <del> def last <del> if loaded? <del> @records.last <del> else <del> @last ||= reverse_order.limit(1).to_a[0] <del> end <del> end <del> <ide> def size <ide> loaded? ? @records.length : count <ide> end <ide> def method_missing(method, *args, &block) <ide> end <ide> end <ide> <del> def find_by_attributes(match, attributes, *args) <del> conditions = attributes.inject({}) {|h, a| h[a] = args[attributes.index(a)]; h} <del> result = where(conditions).send(match.finder) <del> <del> if match.bang? && result.blank? <del> raise RecordNotFound, "Couldn't find #{@klass.name} with #{conditions.to_a.collect {|p| p.join(' = ')}.join(', ')}" <del> else <del> result <del> end <del> end <del> <del> def find_or_instantiator_by_attributes(match, attributes, *args) <del> guard_protected_attributes = false <del> <del> if args[0].is_a?(Hash) <del> guard_protected_attributes = true <del> attributes_for_create = args[0].with_indifferent_access <del> conditions = attributes_for_create.slice(*attributes).symbolize_keys <del> else <del> attributes_for_create = conditions = attributes.inject({}) {|h, a| h[a] = args[attributes.index(a)]; h} <del> end <del> <del> record = where(conditions).first <del> <del> unless record <del> record = @klass.new { |r| r.send(:attributes=, attributes_for_create, guard_protected_attributes) } <del> yield(record) if block_given? <del> record.save if match.instantiator == :create <del> end <del> <del> record <del> end <del> <del> def find_one(id) <del> record = where(@klass.primary_key => id).first <del> <del> unless record <del> conditions = where_clause(', ') <del> conditions = " [WHERE #{conditions}]" if conditions.present? <del> raise RecordNotFound, "Couldn't find #{@klass.name} with ID=#{id}#{conditions}" <del> end <del> <del> record <del> end <del> <del> def find_some(ids) <del> result = where(@klass.primary_key => ids).all <del> <del> expected_size = <del> if @relation.taken && ids.size > @relation.taken <del> @relation.taken <del> else <del> ids.size <del> end <del> <del> # 11 ids with limit 3, offset 9 should give 2 results. <del> if @relation.skipped && (ids.size - @relation.skipped < expected_size) <del> expected_size = ids.size - @relation.skipped <del> end <del> <del> if result.size == expected_size <del> result <del> else <del> conditions = where_clause(', ') <del> conditions = " [WHERE #{conditions}]" if conditions.present? <del> <del> error = "Couldn't find all #{@klass.name.pluralize} with IDs " <del> error << "(#{ids.join(", ")})#{conditions} (found #{result.size} results, but was looking for #{expected_size})" <del> raise RecordNotFound, error <del> end <del> end <del> <ide> def where_clause(join_string = "\n\tAND ") <ide> @relation.send(:where_clauses).join(join_string) <ide> end <ide> <del> def reverse_sql_order(order_query) <del> order_query.to_s.split(/,/).each { |s| <del> if s.match(/\s(asc|ASC)$/) <del> s.gsub!(/\s(asc|ASC)$/, ' DESC') <del> elsif s.match(/\s(desc|DESC)$/) <del> s.gsub!(/\s(desc|DESC)$/, ' ASC') <del> else <del> s.concat(' DESC') <del> end <del> }.join(',') <del> end <del> <ide> end <ide> end <add><path>activerecord/lib/active_record/relation/calculation_methods.rb <del><path>activerecord/lib/active_record/relational_calculations.rb <ide> module ActiveRecord <del> module RelationalCalculations <add> module CalculationMethods <ide> <ide> def count(*args) <ide> calculate(:count, *construct_count_options_from_args(*args)) <ide><path>activerecord/lib/active_record/relation/finder_methods.rb <add>module ActiveRecord <add> module FinderMethods <add> <add> def find(*ids, &block) <add> return to_a.find(&block) if block_given? <add> <add> expects_array = ids.first.kind_of?(Array) <add> return ids.first if expects_array && ids.first.empty? <add> <add> ids = ids.flatten.compact.uniq <add> <add> case ids.size <add> when 0 <add> raise RecordNotFound, "Couldn't find #{@klass.name} without an ID" <add> when 1 <add> result = find_one(ids.first) <add> expects_array ? [ result ] : result <add> else <add> find_some(ids) <add> end <add> end <add> <add> def exists?(id = nil) <add> relation = select("#{@klass.quoted_table_name}.#{@klass.primary_key}").limit(1) <add> relation = relation.where(@klass.primary_key => id) if id <add> relation.first ? true : false <add> end <add> <add> def first <add> if loaded? <add> @records.first <add> else <add> @first ||= limit(1).to_a[0] <add> end <add> end <add> <add> def last <add> if loaded? <add> @records.last <add> else <add> @last ||= reverse_order.limit(1).to_a[0] <add> end <add> end <add> <add> protected <add> <add> def find_by_attributes(match, attributes, *args) <add> conditions = attributes.inject({}) {|h, a| h[a] = args[attributes.index(a)]; h} <add> result = where(conditions).send(match.finder) <add> <add> if match.bang? && result.blank? <add> raise RecordNotFound, "Couldn't find #{@klass.name} with #{conditions.to_a.collect {|p| p.join(' = ')}.join(', ')}" <add> else <add> result <add> end <add> end <add> <add> def find_or_instantiator_by_attributes(match, attributes, *args) <add> guard_protected_attributes = false <add> <add> if args[0].is_a?(Hash) <add> guard_protected_attributes = true <add> attributes_for_create = args[0].with_indifferent_access <add> conditions = attributes_for_create.slice(*attributes).symbolize_keys <add> else <add> attributes_for_create = conditions = attributes.inject({}) {|h, a| h[a] = args[attributes.index(a)]; h} <add> end <add> <add> record = where(conditions).first <add> <add> unless record <add> record = @klass.new { |r| r.send(:attributes=, attributes_for_create, guard_protected_attributes) } <add> yield(record) if block_given? <add> record.save if match.instantiator == :create <add> end <add> <add> record <add> end <add> <add> def find_one(id) <add> record = where(@klass.primary_key => id).first <add> <add> unless record <add> conditions = where_clause(', ') <add> conditions = " [WHERE #{conditions}]" if conditions.present? <add> raise RecordNotFound, "Couldn't find #{@klass.name} with ID=#{id}#{conditions}" <add> end <add> <add> record <add> end <add> <add> def find_some(ids) <add> result = where(@klass.primary_key => ids).all <add> <add> expected_size = <add> if @relation.taken && ids.size > @relation.taken <add> @relation.taken <add> else <add> ids.size <add> end <add> <add> # 11 ids with limit 3, offset 9 should give 2 results. <add> if @relation.skipped && (ids.size - @relation.skipped < expected_size) <add> expected_size = ids.size - @relation.skipped <add> end <add> <add> if result.size == expected_size <add> result <add> else <add> conditions = where_clause(', ') <add> conditions = " [WHERE #{conditions}]" if conditions.present? <add> <add> error = "Couldn't find all #{@klass.name.pluralize} with IDs " <add> error << "(#{ids.join(", ")})#{conditions} (found #{result.size} results, but was looking for #{expected_size})" <add> raise RecordNotFound, error <add> end <add> end <add> <add> end <add>end <ide><path>activerecord/lib/active_record/relation/query_methods.rb <add>module ActiveRecord <add> module QueryMethods <add> <add> def preload(*associations) <add> spawn.tap {|r| r.preload_associations += Array.wrap(associations) } <add> end <add> <add> def eager_load(*associations) <add> spawn.tap {|r| r.eager_load_associations += Array.wrap(associations) } <add> end <add> <add> def readonly(status = true) <add> spawn.tap {|r| r.readonly = status } <add> end <add> <add> def select(selects) <add> if selects.present? <add> relation = spawn(@relation.project(selects)) <add> relation.readonly = @relation.joins(relation).present? ? false : @readonly <add> relation <add> else <add> spawn <add> end <add> end <add> <add> def from(from) <add> from.present? ? spawn(@relation.from(from)) : spawn <add> end <add> <add> def having(*args) <add> return spawn if args.blank? <add> <add> if [String, Hash, Array].include?(args.first.class) <add> havings = @klass.send(:merge_conditions, args.size > 1 ? Array.wrap(args) : args.first) <add> else <add> havings = args.first <add> end <add> <add> spawn(@relation.having(havings)) <add> end <add> <add> def group(groups) <add> groups.present? ? spawn(@relation.group(groups)) : spawn <add> end <add> <add> def order(orders) <add> orders.present? ? spawn(@relation.order(orders)) : spawn <add> end <add> <add> def lock(locks = true) <add> case locks <add> when String <add> spawn(@relation.lock(locks)) <add> when TrueClass, NilClass <add> spawn(@relation.lock) <add> else <add> spawn <add> end <add> end <add> <add> def reverse_order <add> relation = spawn <add> relation.instance_variable_set(:@orders, nil) <add> <add> order_clause = @relation.send(:order_clauses).join(', ') <add> if order_clause.present? <add> relation.order(reverse_sql_order(order_clause)) <add> else <add> relation.order("#{@klass.table_name}.#{@klass.primary_key} DESC") <add> end <add> end <add> <add> def limit(limits) <add> limits.present? ? spawn(@relation.take(limits)) : spawn <add> end <add> <add> def offset(offsets) <add> offsets.present? ? spawn(@relation.skip(offsets)) : spawn <add> end <add> <add> def on(join) <add> spawn(@relation.on(join)) <add> end <add> <add> def joins(join, join_type = nil) <add> return spawn if join.blank? <add> <add> join_relation = case join <add> when String <add> @relation.join(join) <add> when Hash, Array, Symbol <add> if @klass.send(:array_of_strings?, join) <add> @relation.join(join.join(' ')) <add> else <add> @relation.join(@klass.send(:build_association_joins, join)) <add> end <add> else <add> @relation.join(join, join_type) <add> end <add> <add> spawn(join_relation).tap { |r| r.readonly = true } <add> end <add> <add> def where(*args) <add> return spawn if args.blank? <add> <add> if [String, Hash, Array].include?(args.first.class) <add> conditions = @klass.send(:merge_conditions, args.size > 1 ? Array.wrap(args) : args.first) <add> conditions = Arel::SqlLiteral.new(conditions) if conditions <add> else <add> conditions = args.first <add> end <add> <add> spawn(@relation.where(conditions)) <add> end <add> <add> private <add> <add> def reverse_sql_order(order_query) <add> order_query.to_s.split(/,/).each { |s| <add> if s.match(/\s(asc|ASC)$/) <add> s.gsub!(/\s(asc|ASC)$/, ' DESC') <add> elsif s.match(/\s(desc|DESC)$/) <add> s.gsub!(/\s(desc|DESC)$/, ' ASC') <add> else <add> s.concat(' DESC') <add> end <add> }.join(',') <add> end <add> <add> end <add>end
5
PHP
PHP
apply fixes from styleci
9edd46fc6dcd550e4fd5d081bea37b0a43162165
<ide><path>src/Illuminate/Database/Eloquent/Model.php <ide> public function update(array $attributes = [], array $options = []) <ide> <ide> return $this->fill($attributes)->save($options); <ide> } <del> <add> <ide> /** <ide> * Update the model in the database without raising any events. <ide> *
1
Text
Text
improve documentation for commit subject line
a4d396d85874046ffe6647ecb953fd78e16bcba3
<ide><path>CONTRIBUTING.md <ide> Writing good commit logs is important. A commit log should describe what <ide> changed and why. Follow these guidelines when writing one: <ide> <ide> 1. The first line should be 50 characters or less and contain a short <del> description of the change prefixed with the name of the changed <del> subsystem (e.g. "net: add localAddress and localPort to Socket"). <add> description of the change. All words in the description should be in <add> lowercase with the exception of proper nouns, acronyms, and the ones that <add> refer to code, like function/variable names. The description should <add> be prefixed with the name of the changed subsystem and start with an <add> imperative verb, for example, "net: add localAddress and localPort <add> to Socket". <ide> 2. Keep the second line blank. <ide> 3. Wrap all other lines at 72 columns. <ide> <ide> A good commit log can look something like this: <ide> <ide> ```txt <del>subsystem: explaining the commit in one line <add>subsystem: explain the commit in one line <ide> <ide> Body of commit message is a few lines of text, explaining things <ide> in more detail, possibly giving some background about the issue
1
Text
Text
add some articles
8a61e2b151c9b8ed985c9d508fb4f31c84c155f7
<ide><path>docs/reference/run.md <ide> Dockerfile `USER` instruction, but the operator can override it: <ide> <ide> -u="": Username or UID <ide> <del>> **Note:** if you pass numeric uid, it must be in range 0-2147483647. <add>> **Note:** if you pass a numeric uid, it must be in the range 0-2147483647. <ide> <ide> ### WORKDIR <ide>
1
Mixed
Go
change autolock flag description
41b84e0994f9ec72990b7f0fc758f602f6241bc6
<ide><path>cli/command/swarm/init.go <ide> func newInitCommand(dockerCli *command.DockerCli) *cobra.Command { <ide> flags.Var(&opts.listenAddr, flagListenAddr, "Listen address (format: <ip|interface>[:port])") <ide> flags.StringVar(&opts.advertiseAddr, flagAdvertiseAddr, "", "Advertised address (format: <ip|interface>[:port])") <ide> flags.BoolVar(&opts.forceNewCluster, "force-new-cluster", false, "Force create a new cluster from current state") <add> flags.BoolVar(&opts.autolock, flagAutolock, false, "Enable manager autolocking (requiring an unlock key to start a stopped manager)") <ide> addSwarmFlags(flags, &opts.swarmOptions) <ide> return cmd <ide> } <ide><path>cli/command/swarm/opts.go <ide> func addSwarmFlags(flags *pflag.FlagSet, opts *swarmOptions) { <ide> flags.Var(&opts.externalCA, flagExternalCA, "Specifications of one or more certificate signing endpoints") <ide> flags.Uint64Var(&opts.maxSnapshots, flagMaxSnapshots, 0, "Number of additional Raft snapshots to retain") <ide> flags.Uint64Var(&opts.snapshotInterval, flagSnapshotInterval, 10000, "Number of log entries between Raft snapshots") <del> flags.BoolVar(&opts.autolock, flagAutolock, false, "Enable or disable manager autolocking (requiring an unlock key to start a stopped manager)") <ide> } <ide> <ide> func (opts *swarmOptions) mergeSwarmSpec(spec *swarm.Spec, flags *pflag.FlagSet) { <ide><path>cli/command/swarm/update.go <ide> func newUpdateCommand(dockerCli *command.DockerCli) *cobra.Command { <ide> }, <ide> } <ide> <add> cmd.Flags().BoolVar(&opts.autolock, flagAutolock, false, "Change manager autolocking setting (true|false)") <ide> addSwarmFlags(cmd.Flags(), &opts) <ide> return cmd <ide> } <ide><path>docs/reference/commandline/swarm_init.md <ide> Initialize a swarm <ide> <ide> Options: <ide> --advertise-addr value Advertised address (format: <ip|interface>[:port]) <del> --autolock Enable or disable manager autolocking (requiring an unlock key to start a stopped manager) <add> --autolock Enable manager autolocking (requiring an unlock key to start a stopped manager) <ide> --cert-expiry duration Validity period for node certificates (ns|us|ms|s|m|h) (default 2160h0m0s) <ide> --dispatcher-heartbeat duration Dispatcher heartbeat period (ns|us|ms|s|m|h) (default 5s) <ide> --external-ca value Specifications of one or more certificate signing endpoints <ide><path>docs/reference/commandline/swarm_update.md <ide> Usage: docker swarm update [OPTIONS] <ide> Update the swarm <ide> <ide> Options: <del> --autolock Enable or disable manager autolocking (requiring an unlock key to start a stopped manager) <add> --autolock Change manager autolocking setting (true|false) <ide> --cert-expiry duration Validity period for node certificates (ns|us|ms|s|m|h) (default 2160h0m0s) <ide> --dispatcher-heartbeat duration Dispatcher heartbeat period (ns|us|ms|s|m|h) (default 5s) <ide> --external-ca value Specifications of one or more certificate signing endpoints
5