ashlr-plugin 1.36.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/plugins/marketplace.json +20 -0
- package/.claude-plugin/marketplace.json +39 -0
- package/.claude-plugin/plugin.json +36 -0
- package/.codex/agents/README.md +9 -0
- package/.codex/agents/ashlr-explorer.md +36 -0
- package/.codex/agents/ashlr-worker.md +38 -0
- package/.codex-plugin/plugin.json +45 -0
- package/.mcp.json +14 -0
- package/LICENSE +21 -0
- package/README.md +311 -0
- package/agents/ashlr-code.md +69 -0
- package/agents/ashlr-explore.md +44 -0
- package/agents/ashlr-plan.md +54 -0
- package/bench/fixtures/notebook-large.ipynb +660 -0
- package/bench/fixtures/notebook-small.ipynb +39 -0
- package/bench/fixtures/tasklist-closed.json +62 -0
- package/bench/fixtures/tasklist-large-mixed.json +27 -0
- package/bench/fixtures/tasklist-sprint-open.json +79 -0
- package/bench/fixtures/websearch-bun-runtime.json +32 -0
- package/bench/fixtures/websearch-react-hooks-patterns.json +32 -0
- package/bench/fixtures/websearch-typescript-generics.json +38 -0
- package/bench/refs/node-sdk/.refrev +1 -0
- package/bench/refs/node-sdk/README.md +17 -0
- package/bench/refs/node-sdk/src/agent/agent.ts +163 -0
- package/bench/refs/node-sdk/src/agent/create-agent-ui-stream.ts +83 -0
- package/bench/refs/node-sdk/src/agent/tool-loop-agent.ts +238 -0
- package/bench/refs/node-sdk/src/embed/embed-many.ts +409 -0
- package/bench/refs/node-sdk/src/embed/embed-result.ts +50 -0
- package/bench/refs/node-sdk/src/embed/embed.ts +257 -0
- package/bench/refs/node-sdk/src/error/invalid-argument-error.ts +34 -0
- package/bench/refs/node-sdk/src/error/invalid-tool-input-error.ts +33 -0
- package/bench/refs/node-sdk/src/error/no-object-generated-error.ts +70 -0
- package/bench/refs/node-sdk/src/generate-image/generate-image-result.ts +42 -0
- package/bench/refs/node-sdk/src/generate-image/generate-image.ts +362 -0
- package/bench/refs/node-sdk/src/generate-object/generate-object-result.ts +67 -0
- package/bench/refs/node-sdk/src/generate-object/generate-object.ts +501 -0
- package/bench/refs/node-sdk/src/generate-object/inject-json-instruction.ts +30 -0
- package/bench/refs/node-sdk/src/generate-object/output-strategy.ts +415 -0
- package/bench/refs/node-sdk/src/generate-object/repair-text.ts +12 -0
- package/bench/refs/node-sdk/src/generate-object/stream-object.ts +960 -0
- package/bench/refs/node-sdk/src/generate-speech/generate-speech.ts +191 -0
- package/bench/refs/node-sdk/src/generate-text/generate-text.ts +1484 -0
- package/bench/refs/node-sdk/src/generate-text/stream-text.ts +2708 -0
- package/bench/refs/node-sdk/src/generate-text/tool-call.ts +59 -0
- package/bench/refs/node-sdk/src/generate-text/tool-result.ts +36 -0
- package/bench/refs/node-sdk/src/telemetry/create-telemetry-dispatcher.ts +146 -0
- package/bench/refs/node-sdk/src/telemetry/telemetry-registry.ts +15 -0
- package/bench/refs/node-sdk/src/telemetry/telemetry.ts +223 -0
- package/bench/refs/node-sdk/src/util/async-iterable-stream.ts +94 -0
- package/bench/refs/node-sdk/src/util/consume-stream.ts +31 -0
- package/bench/refs/node-sdk/src/util/create-stitchable-stream.ts +112 -0
- package/bench/refs/node-sdk/src/util/download/download.ts +74 -0
- package/bench/refs/node-sdk/src/util/error-handler.ts +1 -0
- package/bench/refs/node-sdk/src/util/fix-json.ts +401 -0
- package/bench/refs/node-sdk/src/util/merge-objects.ts +79 -0
- package/bench/refs/python-lib/.refrev +1 -0
- package/bench/refs/python-lib/README.md +18 -0
- package/bench/refs/python-lib/pandas/core/_numba/executor.py +249 -0
- package/bench/refs/python-lib/pandas/core/_numba/extensions.py +586 -0
- package/bench/refs/python-lib/pandas/core/_numba/kernels/mean_.py +198 -0
- package/bench/refs/python-lib/pandas/core/_numba/kernels/min_max_.py +178 -0
- package/bench/refs/python-lib/pandas/core/_numba/kernels/sum_.py +255 -0
- package/bench/refs/python-lib/pandas/core/_numba/kernels/var_.py +251 -0
- package/bench/refs/python-lib/pandas/core/accessor.py +520 -0
- package/bench/refs/python-lib/pandas/core/api.py +138 -0
- package/bench/refs/python-lib/pandas/core/array_algos/masked_accumulations.py +97 -0
- package/bench/refs/python-lib/pandas/core/array_algos/masked_reductions.py +252 -0
- package/bench/refs/python-lib/pandas/core/array_algos/putmask.py +150 -0
- package/bench/refs/python-lib/pandas/core/array_algos/quantile.py +232 -0
- package/bench/refs/python-lib/pandas/core/array_algos/replace.py +159 -0
- package/bench/refs/python-lib/pandas/core/array_algos/take.py +609 -0
- package/bench/refs/python-lib/pandas/core/arraylike.py +534 -0
- package/bench/refs/python-lib/pandas/core/arrays/_arrow_string_mixins.py +434 -0
- package/bench/refs/python-lib/pandas/core/arrays/_mixins.py +630 -0
- package/bench/refs/python-lib/pandas/core/arrays/_ranges.py +276 -0
- package/bench/refs/python-lib/pandas/core/arrays/_utils.py +77 -0
- package/bench/refs/python-lib/pandas/core/arrays/arrow/accessors.py +521 -0
- package/bench/refs/python-lib/pandas/core/arrays/arrow/extension_types.py +174 -0
- package/bench/refs/python-lib/pandas/core/arrays/boolean.py +454 -0
- package/bench/refs/python-lib/pandas/core/arrays/floating.py +192 -0
- package/bench/refs/python-lib/pandas/core/arrays/integer.py +296 -0
- package/bench/refs/python-lib/pandas/core/arrays/masked.py +2140 -0
- package/bench/refs/python-lib/pandas/core/arrays/numeric.py +305 -0
- package/bench/refs/python-lib/pandas/core/arrays/numpy_.py +701 -0
- package/bench/refs/python-lib/pandas/core/arrays/period.py +1586 -0
- package/bench/refs/python-lib/pandas/core/arrays/sparse/accessor.py +505 -0
- package/bench/refs/python-lib/pandas/core/arrays/sparse/scipy_sparse.py +208 -0
- package/bench/refs/rust-project/.refrev +1 -0
- package/bench/refs/rust-project/README.md +17 -0
- package/bench/refs/rust-project/tokio/src/doc/os.rs +68 -0
- package/bench/refs/rust-project/tokio/src/fs/dir_builder.rs +129 -0
- package/bench/refs/rust-project/tokio/src/fs/file.rs +1113 -0
- package/bench/refs/rust-project/tokio/src/fs/mocks.rs +176 -0
- package/bench/refs/rust-project/tokio/src/fs/mod.rs +324 -0
- package/bench/refs/rust-project/tokio/src/fs/open_options.rs +856 -0
- package/bench/refs/rust-project/tokio/src/fs/read.rs +80 -0
- package/bench/refs/rust-project/tokio/src/fs/read_dir.rs +357 -0
- package/bench/refs/rust-project/tokio/src/fs/write.rs +99 -0
- package/bench/refs/rust-project/tokio/src/future/maybe_done.rs +123 -0
- package/bench/refs/rust-project/tokio/src/future/try_join.rs +82 -0
- package/bench/refs/rust-project/tokio/src/io/async_buf_read.rs +117 -0
- package/bench/refs/rust-project/tokio/src/io/async_read.rs +133 -0
- package/bench/refs/rust-project/tokio/src/io/async_seek.rs +96 -0
- package/bench/refs/rust-project/tokio/src/io/async_write.rs +402 -0
- package/bench/refs/rust-project/tokio/src/io/blocking.rs +339 -0
- package/bench/refs/rust-project/tokio/src/io/interest.rs +345 -0
- package/bench/refs/rust-project/tokio/src/io/join.rs +130 -0
- package/bench/refs/rust-project/tokio/src/io/mod.rs +308 -0
- package/bench/refs/rust-project/tokio/src/io/poll_evented.rs +319 -0
- package/bench/refs/rust-project/tokio/src/io/read_buf.rs +344 -0
- package/bench/refs/rust-project/tokio/src/io/ready.rs +322 -0
- package/bench/refs/rust-project/tokio/src/io/split.rs +166 -0
- package/bench/refs/rust-project/tokio/src/io/stderr.rs +148 -0
- package/bench/refs/rust-project/tokio/src/io/stdin.rs +98 -0
- package/bench/refs/rust-project/tokio/src/io/stdio_common.rs +222 -0
- package/bench/refs/rust-project/tokio/src/io/stdout.rs +197 -0
- package/bench/refs/rust-project/tokio/src/io/util/buf_reader.rs +311 -0
- package/bench/refs/rust-project/tokio/src/io/util/buf_stream.rs +207 -0
- package/bench/refs/rust-project/tokio/src/io/util/buf_writer.rs +310 -0
- package/bench/refs/rust-project/tokio/src/io/util/chain.rs +144 -0
- package/commands/_spawn-patterns.json +32 -0
- package/commands/ashlr-allow.md +21 -0
- package/commands/ashlr-benchmark.md +53 -0
- package/commands/ashlr-brief.md +97 -0
- package/commands/ashlr-budget.md +76 -0
- package/commands/ashlr-compact.md +54 -0
- package/commands/ashlr-dashboard.md +37 -0
- package/commands/ashlr-doctor.md +56 -0
- package/commands/ashlr-eco-mode.md +92 -0
- package/commands/ashlr-genome-init.md +24 -0
- package/commands/ashlr-genome-keygen.md +36 -0
- package/commands/ashlr-genome-loop.md +118 -0
- package/commands/ashlr-genome-push.md +36 -0
- package/commands/ashlr-genome-rewrap.md +48 -0
- package/commands/ashlr-genome-team-init.md +67 -0
- package/commands/ashlr-handoff.md +23 -0
- package/commands/ashlr-help.md +86 -0
- package/commands/ashlr-hook-timings.md +30 -0
- package/commands/ashlr-leaderboard.md +50 -0
- package/commands/ashlr-ollama-setup.md +39 -0
- package/commands/ashlr-orchestrate-status.md +72 -0
- package/commands/ashlr-orchestrate.md +83 -0
- package/commands/ashlr-parallelize.md +63 -0
- package/commands/ashlr-report-crash.md +33 -0
- package/commands/ashlr-resume.md +72 -0
- package/commands/ashlr-savings.md +24 -0
- package/commands/ashlr-settings.md +50 -0
- package/commands/ashlr-spawn.md +61 -0
- package/commands/ashlr-start.md +60 -0
- package/commands/ashlr-status.md +64 -0
- package/commands/ashlr-team-invite.md +47 -0
- package/commands/ashlr-tier.md +122 -0
- package/commands/ashlr-tour.md +60 -0
- package/commands/ashlr-update.md +155 -0
- package/commands/ashlr-upgrade.md +96 -0
- package/commands/goal.md +58 -0
- package/commands/loop.md +40 -0
- package/docs/CNAME +1 -0
- package/docs/PRO_TIER.md +104 -0
- package/docs/README.md +21 -0
- package/docs/architecture.md +415 -0
- package/docs/ashlr-pipe.md +161 -0
- package/docs/assets/logo.svg +19 -0
- package/docs/assets/og.png +0 -0
- package/docs/assets/og.svg +41 -0
- package/docs/benchmarks-v2.json +355 -0
- package/docs/benchmarks.json +102 -0
- package/docs/benchmarks.md +211 -0
- package/docs/billing.md +185 -0
- package/docs/cloud-genome.md +155 -0
- package/docs/competitive-wozcode.md +92 -0
- package/docs/deploy.md +325 -0
- package/docs/email-templates.md +113 -0
- package/docs/embed-tuning.md +103 -0
- package/docs/genome.md +120 -0
- package/docs/github-oauth-onboarding.md +127 -0
- package/docs/hero-video-script.md +129 -0
- package/docs/index.html +2262 -0
- package/docs/install-prompt.md +78 -0
- package/docs/install-windows.md +132 -0
- package/docs/install.ps1 +171 -0
- package/docs/install.sh +146 -0
- package/docs/launch/README.md +114 -0
- package/docs/launch/hn.md +49 -0
- package/docs/launch/reddit.md +45 -0
- package/docs/launch/x.md +65 -0
- package/docs/launch-post.md +112 -0
- package/docs/legal.md +78 -0
- package/docs/llm-providers.md +99 -0
- package/docs/multi-host-mcp.md +217 -0
- package/docs/multi-turn-architecture.md +108 -0
- package/docs/operations/deployment.md +108 -0
- package/docs/operations/error-monitoring.md +70 -0
- package/docs/operations/weekly-digest.md +70 -0
- package/docs/operations.md +494 -0
- package/docs/platform-support.md +133 -0
- package/docs/policy-packs.md +188 -0
- package/docs/press-kit/fact-sheet.md +78 -0
- package/docs/press-kit/founder-bio.md +3 -0
- package/docs/press-kit/logo.svg +33 -0
- package/docs/press-kit/screenshots.md +146 -0
- package/docs/pricing.md +251 -0
- package/docs/pro-backend-architecture.md +523 -0
- package/docs/producthunt.md +52 -0
- package/docs/router-migration.md +110 -0
- package/docs/session-log-schema.md +68 -0
- package/docs/social.md +95 -0
- package/docs/team-genome.md +528 -0
- package/docs/telemetry.md +194 -0
- package/docs/test-isolation.md +100 -0
- package/docs/upgrade.md +159 -0
- package/hooks/_hook-errors.ts +87 -0
- package/hooks/_hook-perf-emit.ts +113 -0
- package/hooks/_hook-timing-ledger.ts +1133 -0
- package/hooks/_nudge-throttle.ts +127 -0
- package/hooks/_recent-blocks.ts +127 -0
- package/hooks/audit-upload.ts +86 -0
- package/hooks/codex-hooks.json +171 -0
- package/hooks/commit-attribution.ts +179 -0
- package/hooks/edit-batching-nudge.ts +154 -0
- package/hooks/genome-scribe-hook.ts +219 -0
- package/hooks/hooks.json +294 -0
- package/hooks/orient-nudge-hook.ts +242 -0
- package/hooks/policy-enforce.ts +214 -0
- package/hooks/post-tool-use-embedding.ts +93 -0
- package/hooks/post-tool-use-genome.sh +37 -0
- package/hooks/post-tool-use-genome.ts +69 -0
- package/hooks/posttooluse-correlate.ts +122 -0
- package/hooks/posttooluse-dedupe-output.ts +241 -0
- package/hooks/posttooluse-genome-refresh.ts +223 -0
- package/hooks/posttooluse-native-nudge.ts +205 -0
- package/hooks/posttooluse-stale-result.ts +277 -0
- package/hooks/pretooluse-bash.ts +63 -0
- package/hooks/pretooluse-budget-guard.ts +318 -0
- package/hooks/pretooluse-common.ts +985 -0
- package/hooks/pretooluse-eco-router.ts +196 -0
- package/hooks/pretooluse-edit.sh +93 -0
- package/hooks/pretooluse-edit.ts +197 -0
- package/hooks/pretooluse-glob.ts +70 -0
- package/hooks/pretooluse-grep.sh +85 -0
- package/hooks/pretooluse-grep.ts +96 -0
- package/hooks/pretooluse-notebookedit.ts +121 -0
- package/hooks/pretooluse-read.sh +118 -0
- package/hooks/pretooluse-read.ts +118 -0
- package/hooks/pretooluse-task.ts +130 -0
- package/hooks/pretooluse-webfetch.ts +66 -0
- package/hooks/pretooluse-websearch.ts +85 -0
- package/hooks/pretooluse-write.ts +128 -0
- package/hooks/pulse-emit.ts +197 -0
- package/hooks/session-end-consolidate.sh +35 -0
- package/hooks/session-end-consolidate.ts +188 -0
- package/hooks/session-end-stats-gc.ts +80 -0
- package/hooks/session-log-append.sh +94 -0
- package/hooks/session-log-append.ts +116 -0
- package/hooks/session-start.ts +993 -0
- package/hooks/sessionend-hook-health-nudge.ts +451 -0
- package/hooks/sessionend-savings-nudge.ts +318 -0
- package/hooks/sessionend-status-line-nudge.ts +296 -0
- package/hooks/sessionstart-brief.ts +140 -0
- package/hooks/sessionstart-cost-refactor.ts +95 -0
- package/hooks/sessionstart-efficient.ts +110 -0
- package/hooks/sessionstart-genome-author.ts +93 -0
- package/hooks/sessionstart-lean-tools.ts +98 -0
- package/hooks/sessionstart-search.ts +97 -0
- package/hooks/stop-accounting.ts +152 -0
- package/hooks/subagent-stop-rollup.ts +162 -0
- package/hooks/userpromptsubmit-brief-trigger.ts +156 -0
- package/package.json +56 -0
- package/ports/README.md +108 -0
- package/ports/cursor/mcp.json +11 -0
- package/ports/goose/recipe.yaml +26 -0
- package/scripts/ashlr-mcp.ts +40 -0
- package/scripts/auto-update.ts +177 -0
- package/scripts/baseline-scan.ts +831 -0
- package/scripts/bench-orchestrate.ts +377 -0
- package/scripts/benchmark-refs.ts +292 -0
- package/scripts/bootstrap.mjs +100 -0
- package/scripts/brief-eval.ts +234 -0
- package/scripts/bump-version.ts +82 -0
- package/scripts/bun-resolve.d.mts +11 -0
- package/scripts/bun-resolve.mjs +59 -0
- package/scripts/calibrate-grep.ts +467 -0
- package/scripts/capture-grep-workload.ts +260 -0
- package/scripts/check-tier.ts +61 -0
- package/scripts/check-version-sync.ts +97 -0
- package/scripts/cli-orchestrate-status.ts +386 -0
- package/scripts/cli-orchestrate.ts +303 -0
- package/scripts/cli.ts +478 -0
- package/scripts/cloud-smoke-test.ts +313 -0
- package/scripts/coach-report.ts +373 -0
- package/scripts/context-db-migrate.ts +137 -0
- package/scripts/context-status.ts +43 -0
- package/scripts/demo-run.ts +255 -0
- package/scripts/deploy-smoke.sh +140 -0
- package/scripts/doctor.ts +992 -0
- package/scripts/embed-file-worker.ts +104 -0
- package/scripts/embed-tune.ts +308 -0
- package/scripts/errors-report.ts +428 -0
- package/scripts/find-test-leak.ts +69 -0
- package/scripts/generate-badge.ts +357 -0
- package/scripts/genome-auto-consolidate.ts +533 -0
- package/scripts/genome-auto-propose.ts +578 -0
- package/scripts/genome-cloud-pull.ts +363 -0
- package/scripts/genome-cloud-push.ts +382 -0
- package/scripts/genome-cloud-sync.ts +587 -0
- package/scripts/genome-commit-watcher.ts +295 -0
- package/scripts/genome-init.ts +986 -0
- package/scripts/genome-key.ts +233 -0
- package/scripts/genome-keygen.ts +168 -0
- package/scripts/genome-link.ts +59 -0
- package/scripts/genome-refresh-worker.ts +364 -0
- package/scripts/genome-rewrap.ts +90 -0
- package/scripts/genome-synthesizer.ts +679 -0
- package/scripts/genome-team-init.ts +312 -0
- package/scripts/handoff-pack.ts +438 -0
- package/scripts/hook-bootstrap.mjs +75 -0
- package/scripts/hook-timing-reader.ts +371 -0
- package/scripts/hook-timings-report.ts +554 -0
- package/scripts/install-genome-hooks.ts +196 -0
- package/scripts/install-onnx-model.ts +154 -0
- package/scripts/install-permissions.ts +276 -0
- package/scripts/install-status-line.ts +150 -0
- package/scripts/mcp-entrypoint.sh +78 -0
- package/scripts/mcp-entrypoint.ts +130 -0
- package/scripts/mdx-angle-bracket-lint.ts +152 -0
- package/scripts/measure-cold-start.ts +126 -0
- package/scripts/migrate-stats-to-sqlite.ts +86 -0
- package/scripts/ollama-setup.ts +498 -0
- package/scripts/onboarding-wizard.ts +1691 -0
- package/scripts/orchestrate-emit-telemetry.ts +177 -0
- package/scripts/orchestrate-expand.ts +517 -0
- package/scripts/orchestrate-run.ts +744 -0
- package/scripts/print-legend.ts +50 -0
- package/scripts/product-metadata.ts +38 -0
- package/scripts/prune-old-memories.ts +208 -0
- package/scripts/publish.sh +88 -0
- package/scripts/read-calibration.ts +122 -0
- package/scripts/report-crash.ts +226 -0
- package/scripts/run-benchmark.ts +750 -0
- package/scripts/run-root-tests.ts +28 -0
- package/scripts/savings-dashboard.ts +1258 -0
- package/scripts/savings-report-extras.ts +447 -0
- package/scripts/savings-status-line.ts +873 -0
- package/scripts/session-event-emit.ts +266 -0
- package/scripts/session-greet.ts +686 -0
- package/scripts/session-log-report.ts +551 -0
- package/scripts/session-resume.ts +614 -0
- package/scripts/set-hook-mode.ts +83 -0
- package/scripts/smoke-cross-platform.ts +117 -0
- package/scripts/smoke-realtime.ts +257 -0
- package/scripts/smoke-tools.ts +21 -0
- package/scripts/stats-cloud-pull.ts +213 -0
- package/scripts/stats-cloud-sync.ts +261 -0
- package/scripts/telemetry-flush.ts +160 -0
- package/scripts/telemetry-status.ts +266 -0
- package/scripts/timing-budget.ts +35 -0
- package/scripts/ui-animation.ts +120 -0
- package/scripts/ui.ts +431 -0
- package/scripts/upgrade-flow.ts +775 -0
- package/scripts/weekly-digest.ts +394 -0
- package/servers/_accounting.ts +78 -0
- package/servers/_ask-router.ts +84 -0
- package/servers/_ast-chunker.ts +434 -0
- package/servers/_ast-helpers.ts +183 -0
- package/servers/_ast-languages.ts +153 -0
- package/servers/_ast-refactor/_shared.ts +221 -0
- package/servers/_ast-refactor/cross-file-rename.ts +560 -0
- package/servers/_ast-refactor/extract-function.ts +357 -0
- package/servers/_ast-refactor/file-local-rename.ts +172 -0
- package/servers/_ast-refactor.ts +41 -0
- package/servers/_ast-skeleton.ts +107 -0
- package/servers/_bash-summarizers-registry.ts +1096 -0
- package/servers/_crash-dump.ts +210 -0
- package/servers/_cwd-clamp.ts +342 -0
- package/servers/_edit-log.ts +28 -0
- package/servers/_edit-match.ts +236 -0
- package/servers/_edit-validate.ts +196 -0
- package/servers/_embed-calibration.ts +123 -0
- package/servers/_embedding-cache.ts +401 -0
- package/servers/_embedding-model.ts +329 -0
- package/servers/_events.ts +113 -0
- package/servers/_genome-cache.ts +154 -0
- package/servers/_genome-commits.ts +172 -0
- package/servers/_genome-crypto-v2.ts +242 -0
- package/servers/_genome-crypto.ts +259 -0
- package/servers/_genome-discoveries.ts +140 -0
- package/servers/_genome-embed-populator.ts +216 -0
- package/servers/_genome-freshness.ts +134 -0
- package/servers/_genome-issues.ts +171 -0
- package/servers/_genome-live.ts +263 -0
- package/servers/_genome-prs.ts +188 -0
- package/servers/_genome-search.ts +479 -0
- package/servers/_genome-sync.ts +297 -0
- package/servers/_history-tracker.ts +279 -0
- package/servers/_http-helpers.ts +151 -0
- package/servers/_identity-hash.ts +151 -0
- package/servers/_llm-providers/anthropic.ts +132 -0
- package/servers/_llm-providers/cloud.ts +195 -0
- package/servers/_llm-providers/index.ts +350 -0
- package/servers/_llm-providers/local.ts +127 -0
- package/servers/_llm-providers/onnx.ts +393 -0
- package/servers/_llm-providers/types.ts +27 -0
- package/servers/_manifest-v2.ts +447 -0
- package/servers/_mcp-host.ts +93 -0
- package/servers/_nudge-events.ts +451 -0
- package/servers/_orchestrate-executor.ts +316 -0
- package/servers/_prefetch.ts +435 -0
- package/servers/_pricing.ts +256 -0
- package/servers/_pro.ts +381 -0
- package/servers/_read-cache.ts +44 -0
- package/servers/_router-handlers.ts +46 -0
- package/servers/_router.ts +55 -0
- package/servers/_run-with-timeout.ts +173 -0
- package/servers/_savings-render.ts +214 -0
- package/servers/_stats-sqlite.ts +640 -0
- package/servers/_stats.ts +1183 -0
- package/servers/_status-line-cells.ts +469 -0
- package/servers/_streaks.ts +162 -0
- package/servers/_summarize.ts +208 -0
- package/servers/_task-graph-render.ts +217 -0
- package/servers/_task-graph.ts +545 -0
- package/servers/_telemetry.ts +719 -0
- package/servers/_test-parsers.ts +530 -0
- package/servers/_test-watch.ts +626 -0
- package/servers/_text-helpers.ts +37 -0
- package/servers/_token-measure.ts +160 -0
- package/servers/_tool-base.ts +248 -0
- package/servers/_weekly-digest.ts +391 -0
- package/servers/ask-server-handlers.ts +49 -0
- package/servers/ask-server.ts +174 -0
- package/servers/bash-server-handlers.ts +138 -0
- package/servers/bash-server.ts +1136 -0
- package/servers/bench.ts +186 -0
- package/servers/diff-semantic-server-handlers.ts +39 -0
- package/servers/diff-semantic-server.ts +566 -0
- package/servers/diff-server-handlers.ts +317 -0
- package/servers/diff-server.ts +20 -0
- package/servers/edit-server-handlers.ts +31 -0
- package/servers/edit-server.ts +209 -0
- package/servers/edit-structural-server-handlers.ts +322 -0
- package/servers/efficiency-server-handlers.ts +161 -0
- package/servers/efficiency-server.ts +1135 -0
- package/servers/flush-server-handlers.ts +21 -0
- package/servers/flush-server.ts +19 -0
- package/servers/genome-server-handlers.ts +118 -0
- package/servers/genome-server.ts +397 -0
- package/servers/github-server-handlers.ts +187 -0
- package/servers/github-server.ts +856 -0
- package/servers/glob-server-handlers.ts +233 -0
- package/servers/glob-server.ts +20 -0
- package/servers/grep-server-handlers.ts +61 -0
- package/servers/grep-server.ts +564 -0
- package/servers/http-server-handlers.ts +36 -0
- package/servers/http-server.ts +149 -0
- package/servers/logs-server-handlers.ts +42 -0
- package/servers/logs-server.ts +359 -0
- package/servers/ls-server-handlers.ts +166 -0
- package/servers/ls-server.ts +20 -0
- package/servers/multi-edit-server-handlers.ts +51 -0
- package/servers/multi-edit-server.ts +422 -0
- package/servers/notebook-edit-server-handlers.ts +34 -0
- package/servers/notebook-edit-server.ts +181 -0
- package/servers/orient-server-handlers.ts +52 -0
- package/servers/orient-server.ts +436 -0
- package/servers/pipe-server-handlers.ts +68 -0
- package/servers/pipe-server.ts +300 -0
- package/servers/read-server-handlers.ts +42 -0
- package/servers/read-server.ts +206 -0
- package/servers/rename-file-server-handlers.ts +67 -0
- package/servers/rename-file-server.ts +699 -0
- package/servers/savings-server-handlers.ts +27 -0
- package/servers/savings-server.ts +54 -0
- package/servers/search-replace-regex-server-handlers.ts +96 -0
- package/servers/search-replace-regex-server.ts +751 -0
- package/servers/sql-server-handlers.ts +58 -0
- package/servers/sql-server.ts +505 -0
- package/servers/task-server-handlers.ts +358 -0
- package/servers/task-server.ts +24 -0
- package/servers/test-server-handlers.ts +351 -0
- package/servers/test-server.ts +20 -0
- package/servers/tree-server-handlers.ts +503 -0
- package/servers/tree-server.ts +20 -0
- package/servers/webfetch-server-handlers.ts +166 -0
- package/servers/webfetch-server.ts +20 -0
- package/servers/websearch-server-handlers.ts +215 -0
- package/servers/websearch-server.ts +19 -0
- package/servers/write-server-handlers.ts +27 -0
- package/servers/write-server.ts +97 -0
- package/skills/ashlr-brief/SKILL.md +80 -0
- package/skills/ashlr-codex-doctor/SKILL.md +21 -0
- package/skills/ashlr-codex-efficient-tools/SKILL.md +17 -0
- package/skills/ashlr-codex-genome-refresh/SKILL.md +20 -0
- package/skills/ashlr-codex-parallel-explore/SKILL.md +20 -0
- package/skills/ashlr-codex-savings/SKILL.md +17 -0
- package/skills/ashlr-cost-refactor/SKILL.md +50 -0
- package/skills/ashlr-efficient/SKILL.md +64 -0
- package/skills/ashlr-genome-author/SKILL.md +43 -0
- package/skills/ashlr-lean-tools/SKILL.md +43 -0
- package/skills/ashlr-search/SKILL.md +46 -0
|
@@ -0,0 +1,701 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import (
|
|
4
|
+
TYPE_CHECKING,
|
|
5
|
+
Any,
|
|
6
|
+
Literal,
|
|
7
|
+
Self,
|
|
8
|
+
cast,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
import numpy as np
|
|
12
|
+
|
|
13
|
+
from pandas._libs import lib
|
|
14
|
+
from pandas._libs.tslibs import is_supported_dtype
|
|
15
|
+
from pandas.compat.numpy import function as nv
|
|
16
|
+
from pandas.errors import LossySetitemError
|
|
17
|
+
from pandas.util._decorators import set_module
|
|
18
|
+
|
|
19
|
+
from pandas.core.dtypes.astype import (
|
|
20
|
+
astype_array,
|
|
21
|
+
astype_float_to_int_nansafe,
|
|
22
|
+
astype_is_view,
|
|
23
|
+
)
|
|
24
|
+
from pandas.core.dtypes.cast import (
|
|
25
|
+
construct_1d_object_array_from_listlike,
|
|
26
|
+
maybe_downcast_to_dtype,
|
|
27
|
+
np_can_hold_element,
|
|
28
|
+
)
|
|
29
|
+
from pandas.core.dtypes.common import pandas_dtype
|
|
30
|
+
from pandas.core.dtypes.dtypes import NumpyEADtype
|
|
31
|
+
from pandas.core.dtypes.missing import (
|
|
32
|
+
is_valid_na_for_dtype,
|
|
33
|
+
isna,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
from pandas.core import (
|
|
37
|
+
arraylike,
|
|
38
|
+
missing,
|
|
39
|
+
nanops,
|
|
40
|
+
ops,
|
|
41
|
+
)
|
|
42
|
+
from pandas.core.arraylike import OpsMixin
|
|
43
|
+
from pandas.core.arrays._mixins import NDArrayBackedExtensionArray
|
|
44
|
+
from pandas.core.construction import ensure_wrapped_if_datetimelike
|
|
45
|
+
from pandas.core.strings.object_array import ObjectStringArrayMixin
|
|
46
|
+
|
|
47
|
+
if TYPE_CHECKING:
|
|
48
|
+
from collections.abc import Callable
|
|
49
|
+
|
|
50
|
+
from pandas._typing import (
|
|
51
|
+
ArrayLike,
|
|
52
|
+
AxisInt,
|
|
53
|
+
Dtype,
|
|
54
|
+
FillnaOptions,
|
|
55
|
+
InterpolateOptions,
|
|
56
|
+
NpDtype,
|
|
57
|
+
NumpySorter,
|
|
58
|
+
NumpyValueArrayLike,
|
|
59
|
+
Scalar,
|
|
60
|
+
TakeIndexer,
|
|
61
|
+
npt,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
from pandas import Index
|
|
65
|
+
from pandas.arrays import StringArray
|
|
66
|
+
from pandas.core.arrays.base import ExtensionArray
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@set_module("pandas.arrays")
|
|
70
|
+
class NumpyExtensionArray(
|
|
71
|
+
OpsMixin,
|
|
72
|
+
NDArrayBackedExtensionArray,
|
|
73
|
+
ObjectStringArrayMixin,
|
|
74
|
+
):
|
|
75
|
+
"""
|
|
76
|
+
A pandas ExtensionArray for NumPy data.
|
|
77
|
+
|
|
78
|
+
This is mostly for internal compatibility, and is not especially
|
|
79
|
+
useful on its own.
|
|
80
|
+
|
|
81
|
+
Parameters
|
|
82
|
+
----------
|
|
83
|
+
values : ndarray
|
|
84
|
+
The NumPy ndarray to wrap. Must be 1-dimensional.
|
|
85
|
+
copy : bool, default False
|
|
86
|
+
Whether to copy `values`.
|
|
87
|
+
|
|
88
|
+
Attributes
|
|
89
|
+
----------
|
|
90
|
+
None
|
|
91
|
+
|
|
92
|
+
Methods
|
|
93
|
+
-------
|
|
94
|
+
None
|
|
95
|
+
|
|
96
|
+
See Also
|
|
97
|
+
--------
|
|
98
|
+
array : Create an array.
|
|
99
|
+
Series.to_numpy : Convert a Series to a NumPy array.
|
|
100
|
+
|
|
101
|
+
Examples
|
|
102
|
+
--------
|
|
103
|
+
>>> pd.arrays.NumpyExtensionArray(np.array([0, 1, 2, 3]))
|
|
104
|
+
<NumpyExtensionArray>
|
|
105
|
+
[0, 1, 2, 3]
|
|
106
|
+
Length: 4, dtype: int64
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
# If you're wondering why pd.Series(cls) doesn't put the array in an
|
|
110
|
+
# ExtensionBlock, search for `ABCNumpyExtensionArray`. We check for
|
|
111
|
+
# that _typ to ensure that users don't unnecessarily use EAs inside
|
|
112
|
+
# pandas internals, which turns off things like block consolidation.
|
|
113
|
+
_typ = "npy_extension"
|
|
114
|
+
__array_priority__ = 1000
|
|
115
|
+
_ndarray: np.ndarray
|
|
116
|
+
_dtype: NumpyEADtype
|
|
117
|
+
_internal_fill_value = np.nan
|
|
118
|
+
|
|
119
|
+
# ------------------------------------------------------------------------
|
|
120
|
+
# Constructors
|
|
121
|
+
|
|
122
|
+
def __init__(
|
|
123
|
+
self, values: np.ndarray | NumpyExtensionArray, copy: bool = False
|
|
124
|
+
) -> None:
|
|
125
|
+
if isinstance(values, type(self)):
|
|
126
|
+
values = values._ndarray
|
|
127
|
+
if not isinstance(values, np.ndarray):
|
|
128
|
+
raise ValueError(
|
|
129
|
+
f"'values' must be a NumPy array, not {type(values).__name__}"
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
if values.ndim == 0:
|
|
133
|
+
# Technically we support 2, but do not advertise that fact.
|
|
134
|
+
raise ValueError("NumpyExtensionArray must be 1-dimensional.")
|
|
135
|
+
|
|
136
|
+
if copy:
|
|
137
|
+
values = values.copy()
|
|
138
|
+
|
|
139
|
+
dtype = NumpyEADtype(values.dtype)
|
|
140
|
+
super().__init__(values, dtype)
|
|
141
|
+
|
|
142
|
+
@classmethod
|
|
143
|
+
def _from_sequence(
|
|
144
|
+
cls, scalars, *, dtype: Dtype | None = None, copy: bool = False
|
|
145
|
+
) -> NumpyExtensionArray:
|
|
146
|
+
if isinstance(dtype, NumpyEADtype):
|
|
147
|
+
dtype = dtype._dtype
|
|
148
|
+
if dtype is not None:
|
|
149
|
+
dtype = np.dtype(dtype) # type: ignore[arg-type]
|
|
150
|
+
|
|
151
|
+
if dtype is not None and dtype.kind in "iu":
|
|
152
|
+
# GH#41724 - validate NaN before casting float -> int
|
|
153
|
+
result = np.asarray(scalars)
|
|
154
|
+
if np.issubdtype(result.dtype, np.floating):
|
|
155
|
+
result = astype_float_to_int_nansafe(result, dtype, copy=copy)
|
|
156
|
+
else:
|
|
157
|
+
result = np.asarray(scalars, dtype=dtype)
|
|
158
|
+
else:
|
|
159
|
+
result = np.asarray(scalars, dtype=dtype)
|
|
160
|
+
if (
|
|
161
|
+
result.ndim > 1
|
|
162
|
+
and not hasattr(scalars, "dtype")
|
|
163
|
+
and (dtype is None or dtype == object)
|
|
164
|
+
):
|
|
165
|
+
# e.g. list-of-tuples
|
|
166
|
+
result = construct_1d_object_array_from_listlike(scalars)
|
|
167
|
+
|
|
168
|
+
if copy and result is scalars:
|
|
169
|
+
result = result.copy()
|
|
170
|
+
return cls(result)
|
|
171
|
+
|
|
172
|
+
def _validate_setitem_value(self, value):
|
|
173
|
+
if isinstance(value, type(self)):
|
|
174
|
+
value = value._ndarray
|
|
175
|
+
|
|
176
|
+
# Match Block._standardize_fill_value behavior
|
|
177
|
+
if self._ndarray.dtype.kind != "O" and is_valid_na_for_dtype(
|
|
178
|
+
value, self._ndarray.dtype
|
|
179
|
+
):
|
|
180
|
+
value = self.dtype.na_value
|
|
181
|
+
|
|
182
|
+
try:
|
|
183
|
+
return np_can_hold_element(self._ndarray.dtype, value)
|
|
184
|
+
except LossySetitemError as err:
|
|
185
|
+
raise TypeError(
|
|
186
|
+
f"Invalid value '{value!s}' for dtype '{self.dtype}'"
|
|
187
|
+
) from err
|
|
188
|
+
except NotImplementedError:
|
|
189
|
+
# np_can_hold_element doesn't handle all dtypes (e.g. "U"),
|
|
190
|
+
# fall back to no validation for those.
|
|
191
|
+
return value
|
|
192
|
+
|
|
193
|
+
def searchsorted(
|
|
194
|
+
self,
|
|
195
|
+
value: NumpyValueArrayLike | ExtensionArray,
|
|
196
|
+
side: Literal["left", "right"] = "left",
|
|
197
|
+
sorter: NumpySorter | None = None,
|
|
198
|
+
) -> npt.NDArray[np.intp] | np.intp:
|
|
199
|
+
# Parent's searchsorted calls _validate_setitem_value, which is
|
|
200
|
+
# too strict for search (e.g. rejects float into int). Delegate
|
|
201
|
+
# directly to numpy which handles cross-dtype searches correctly.
|
|
202
|
+
return self._ndarray.searchsorted(value, side=side, sorter=sorter) # type: ignore[arg-type]
|
|
203
|
+
|
|
204
|
+
def _cast_pointwise_result(self, values) -> ArrayLike:
|
|
205
|
+
result = super()._cast_pointwise_result(values)
|
|
206
|
+
lkind = self.dtype.kind
|
|
207
|
+
rkind = result.dtype.kind
|
|
208
|
+
if (
|
|
209
|
+
(lkind in "iu" and rkind in "iu")
|
|
210
|
+
or (lkind == "f" and rkind == "f")
|
|
211
|
+
or (lkind == rkind == "c")
|
|
212
|
+
):
|
|
213
|
+
result = maybe_downcast_to_dtype(result, self.dtype.numpy_dtype)
|
|
214
|
+
elif rkind in "Mm":
|
|
215
|
+
# Ensure potential subsequent .astype(object) doesn't incorrectly
|
|
216
|
+
# convert Timestamps/Timedeltas to ints
|
|
217
|
+
from pandas import array as pd_array
|
|
218
|
+
|
|
219
|
+
result = pd_array(result, copy=False)
|
|
220
|
+
if isinstance(result, np.ndarray) and isinstance(self.dtype, NumpyEADtype):
|
|
221
|
+
# Subclasses like StringArray have their own validation;
|
|
222
|
+
# only wrap for plain NumpyEADtype.
|
|
223
|
+
result = type(self)(result)
|
|
224
|
+
return result
|
|
225
|
+
|
|
226
|
+
# ------------------------------------------------------------------------
|
|
227
|
+
# Data
|
|
228
|
+
|
|
229
|
+
@property
|
|
230
|
+
def dtype(self) -> NumpyEADtype:
|
|
231
|
+
return self._dtype
|
|
232
|
+
|
|
233
|
+
# ------------------------------------------------------------------------
|
|
234
|
+
# NumPy Array Interface
|
|
235
|
+
|
|
236
|
+
def __array__(
|
|
237
|
+
self, dtype: np.dtype | None = None, copy: bool | None = None
|
|
238
|
+
) -> np.ndarray:
|
|
239
|
+
if copy is not None:
|
|
240
|
+
# Note: branch avoids `copy=None` for NumPy 1.x support
|
|
241
|
+
result = np.array(self._ndarray, dtype=dtype, copy=copy)
|
|
242
|
+
else:
|
|
243
|
+
result = np.asarray(self._ndarray, dtype=dtype)
|
|
244
|
+
|
|
245
|
+
if (
|
|
246
|
+
self._readonly
|
|
247
|
+
and not copy
|
|
248
|
+
and (dtype is None or astype_is_view(self.dtype, dtype))
|
|
249
|
+
):
|
|
250
|
+
result = result.view()
|
|
251
|
+
result.flags.writeable = False
|
|
252
|
+
|
|
253
|
+
return result
|
|
254
|
+
|
|
255
|
+
def __array_ufunc__(self, ufunc: np.ufunc, method: str, *inputs, **kwargs):
|
|
256
|
+
# Lightly modified version of
|
|
257
|
+
# https://numpy.org/doc/stable/reference/generated/numpy.lib.mixins.NDArrayOperatorsMixin.html
|
|
258
|
+
# The primary modification is not boxing scalar return values
|
|
259
|
+
# in NumpyExtensionArray, since pandas' ExtensionArrays are 1-d.
|
|
260
|
+
out = kwargs.get("out", ())
|
|
261
|
+
|
|
262
|
+
result = arraylike.maybe_dispatch_ufunc_to_dunder_op(
|
|
263
|
+
self, ufunc, method, *inputs, **kwargs
|
|
264
|
+
)
|
|
265
|
+
if result is not NotImplemented:
|
|
266
|
+
return result
|
|
267
|
+
|
|
268
|
+
if "out" in kwargs:
|
|
269
|
+
# e.g. test_ufunc_unary
|
|
270
|
+
return arraylike.dispatch_ufunc_with_out(
|
|
271
|
+
self, ufunc, method, *inputs, **kwargs
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
if method == "reduce":
|
|
275
|
+
result = arraylike.dispatch_reduction_ufunc(
|
|
276
|
+
self, ufunc, method, *inputs, **kwargs
|
|
277
|
+
)
|
|
278
|
+
if result is not NotImplemented:
|
|
279
|
+
# e.g. tests.series.test_ufunc.TestNumpyReductions
|
|
280
|
+
return result
|
|
281
|
+
|
|
282
|
+
# Defer to the implementation of the ufunc on unwrapped values.
|
|
283
|
+
inputs = tuple(
|
|
284
|
+
x._ndarray if isinstance(x, NumpyExtensionArray) else x for x in inputs
|
|
285
|
+
)
|
|
286
|
+
if out:
|
|
287
|
+
kwargs["out"] = tuple(
|
|
288
|
+
x._ndarray if isinstance(x, NumpyExtensionArray) else x for x in out
|
|
289
|
+
)
|
|
290
|
+
result = getattr(ufunc, method)(*inputs, **kwargs)
|
|
291
|
+
|
|
292
|
+
if ufunc.nout > 1:
|
|
293
|
+
# multiple return values; re-box array-like results
|
|
294
|
+
return tuple(type(self)(x) for x in result)
|
|
295
|
+
elif method == "at":
|
|
296
|
+
# no return value
|
|
297
|
+
return None
|
|
298
|
+
elif method == "reduce":
|
|
299
|
+
if isinstance(result, np.ndarray):
|
|
300
|
+
# e.g. test_np_reduce_2d
|
|
301
|
+
return type(self)(result)
|
|
302
|
+
|
|
303
|
+
# e.g. test_np_max_nested_tuples
|
|
304
|
+
return result
|
|
305
|
+
else:
|
|
306
|
+
if self.dtype.type is str: # type: ignore[comparison-overlap]
|
|
307
|
+
# StringDtype
|
|
308
|
+
self = cast("StringArray", self)
|
|
309
|
+
try:
|
|
310
|
+
# specify dtype to preserve storage/na_value
|
|
311
|
+
return type(self)(result, dtype=self.dtype)
|
|
312
|
+
except ValueError:
|
|
313
|
+
# if validation of input fails (no strings)
|
|
314
|
+
# -> fallback to returning raw numpy array
|
|
315
|
+
return result
|
|
316
|
+
# one return value; re-box array-like results
|
|
317
|
+
return type(self)(result)
|
|
318
|
+
|
|
319
|
+
# ------------------------------------------------------------------------
|
|
320
|
+
# Pandas ExtensionArray Interface
|
|
321
|
+
|
|
322
|
+
def astype(self, dtype, copy: bool = True):
|
|
323
|
+
dtype = pandas_dtype(dtype)
|
|
324
|
+
|
|
325
|
+
if dtype == self.dtype:
|
|
326
|
+
if copy:
|
|
327
|
+
return self.copy()
|
|
328
|
+
return self
|
|
329
|
+
|
|
330
|
+
result = astype_array(self._ndarray, dtype=dtype, copy=copy)
|
|
331
|
+
return result
|
|
332
|
+
|
|
333
|
+
def isna(self) -> np.ndarray:
|
|
334
|
+
return isna(self._ndarray)
|
|
335
|
+
|
|
336
|
+
def _validate_scalar(self, fill_value):
|
|
337
|
+
if fill_value is None:
|
|
338
|
+
# Primarily for subclasses
|
|
339
|
+
fill_value = self.dtype.na_value
|
|
340
|
+
return fill_value
|
|
341
|
+
|
|
342
|
+
def _values_for_factorize(self) -> tuple[np.ndarray, float | None]:
|
|
343
|
+
if self.dtype.kind in "iub":
|
|
344
|
+
fv = None
|
|
345
|
+
else:
|
|
346
|
+
fv = np.nan
|
|
347
|
+
return self._ndarray, fv
|
|
348
|
+
|
|
349
|
+
# Base EA class (and all other EA classes) don't have limit_area keyword
|
|
350
|
+
# This can be removed here as well when the interpolate ffill/bfill method
|
|
351
|
+
# deprecation is enforced
|
|
352
|
+
def _pad_or_backfill(
|
|
353
|
+
self,
|
|
354
|
+
*,
|
|
355
|
+
method: FillnaOptions,
|
|
356
|
+
limit: int | None = None,
|
|
357
|
+
limit_area: Literal["inside", "outside"] | None = None,
|
|
358
|
+
copy: bool = True,
|
|
359
|
+
) -> Self:
|
|
360
|
+
"""
|
|
361
|
+
ffill or bfill along axis=0.
|
|
362
|
+
"""
|
|
363
|
+
if copy:
|
|
364
|
+
out_data = self._ndarray.copy()
|
|
365
|
+
else:
|
|
366
|
+
out_data = self._ndarray
|
|
367
|
+
|
|
368
|
+
meth = missing.clean_fill_method(method)
|
|
369
|
+
missing.pad_or_backfill_inplace(
|
|
370
|
+
out_data.T,
|
|
371
|
+
method=meth,
|
|
372
|
+
axis=0,
|
|
373
|
+
limit=limit,
|
|
374
|
+
limit_area=limit_area,
|
|
375
|
+
)
|
|
376
|
+
|
|
377
|
+
if not copy:
|
|
378
|
+
return self
|
|
379
|
+
return type(self)._simple_new(out_data, dtype=self.dtype)
|
|
380
|
+
|
|
381
|
+
def interpolate(
|
|
382
|
+
self,
|
|
383
|
+
*,
|
|
384
|
+
method: InterpolateOptions,
|
|
385
|
+
axis: int,
|
|
386
|
+
index: Index,
|
|
387
|
+
limit,
|
|
388
|
+
limit_direction,
|
|
389
|
+
limit_area,
|
|
390
|
+
copy: bool,
|
|
391
|
+
**kwargs,
|
|
392
|
+
) -> Self:
|
|
393
|
+
"""
|
|
394
|
+
See NDFrame.interpolate.__doc__.
|
|
395
|
+
"""
|
|
396
|
+
# NB: we return type(self) even if copy=False
|
|
397
|
+
if not self.dtype._is_numeric:
|
|
398
|
+
raise TypeError(f"Cannot interpolate with {self.dtype} dtype")
|
|
399
|
+
|
|
400
|
+
if not copy:
|
|
401
|
+
out_data = self._ndarray
|
|
402
|
+
else:
|
|
403
|
+
out_data = self._ndarray.copy()
|
|
404
|
+
|
|
405
|
+
# TODO: assert we have floating dtype?
|
|
406
|
+
missing.interpolate_2d_inplace(
|
|
407
|
+
out_data,
|
|
408
|
+
method=method,
|
|
409
|
+
axis=axis,
|
|
410
|
+
index=index,
|
|
411
|
+
limit=limit,
|
|
412
|
+
limit_direction=limit_direction,
|
|
413
|
+
limit_area=limit_area,
|
|
414
|
+
**kwargs,
|
|
415
|
+
)
|
|
416
|
+
if not copy:
|
|
417
|
+
return self
|
|
418
|
+
return type(self)._simple_new(out_data, dtype=self.dtype)
|
|
419
|
+
|
|
420
|
+
def take(
|
|
421
|
+
self,
|
|
422
|
+
indices: TakeIndexer,
|
|
423
|
+
*,
|
|
424
|
+
allow_fill: bool = False,
|
|
425
|
+
fill_value: Any = None,
|
|
426
|
+
axis: AxisInt = 0,
|
|
427
|
+
) -> Self:
|
|
428
|
+
"""
|
|
429
|
+
Take entries from this array at each index in a list of indices,
|
|
430
|
+
producing an array containing only those entries.
|
|
431
|
+
"""
|
|
432
|
+
result = super().take(
|
|
433
|
+
indices, allow_fill=allow_fill, fill_value=fill_value, axis=axis
|
|
434
|
+
)
|
|
435
|
+
# See GH#62448.
|
|
436
|
+
if self.dtype.kind in "iub":
|
|
437
|
+
return type(self)(result._ndarray, copy=False)
|
|
438
|
+
|
|
439
|
+
return result
|
|
440
|
+
|
|
441
|
+
# ------------------------------------------------------------------------
|
|
442
|
+
# Reductions
|
|
443
|
+
|
|
444
|
+
def any(
|
|
445
|
+
self,
|
|
446
|
+
*,
|
|
447
|
+
axis: AxisInt | None = None,
|
|
448
|
+
out=None,
|
|
449
|
+
keepdims: bool = False,
|
|
450
|
+
skipna: bool = True,
|
|
451
|
+
):
|
|
452
|
+
nv.validate_any((), {"out": out, "keepdims": keepdims})
|
|
453
|
+
result = nanops.nanany(self._ndarray, axis=axis, skipna=skipna)
|
|
454
|
+
return self._wrap_reduction_result(axis, result)
|
|
455
|
+
|
|
456
|
+
def all(
|
|
457
|
+
self,
|
|
458
|
+
*,
|
|
459
|
+
axis: AxisInt | None = None,
|
|
460
|
+
out=None,
|
|
461
|
+
keepdims: bool = False,
|
|
462
|
+
skipna: bool = True,
|
|
463
|
+
):
|
|
464
|
+
nv.validate_all((), {"out": out, "keepdims": keepdims})
|
|
465
|
+
result = nanops.nanall(self._ndarray, axis=axis, skipna=skipna)
|
|
466
|
+
return self._wrap_reduction_result(axis, result)
|
|
467
|
+
|
|
468
|
+
def min(
|
|
469
|
+
self, *, axis: AxisInt | None = None, skipna: bool = True, **kwargs
|
|
470
|
+
) -> Scalar:
|
|
471
|
+
nv.validate_min((), kwargs)
|
|
472
|
+
result = nanops.nanmin(
|
|
473
|
+
values=self._ndarray, axis=axis, mask=self.isna(), skipna=skipna
|
|
474
|
+
)
|
|
475
|
+
return self._wrap_reduction_result(axis, result)
|
|
476
|
+
|
|
477
|
+
def max(
|
|
478
|
+
self, *, axis: AxisInt | None = None, skipna: bool = True, **kwargs
|
|
479
|
+
) -> Scalar:
|
|
480
|
+
nv.validate_max((), kwargs)
|
|
481
|
+
result = nanops.nanmax(
|
|
482
|
+
values=self._ndarray, axis=axis, mask=self.isna(), skipna=skipna
|
|
483
|
+
)
|
|
484
|
+
return self._wrap_reduction_result(axis, result)
|
|
485
|
+
|
|
486
|
+
def sum(
|
|
487
|
+
self,
|
|
488
|
+
*,
|
|
489
|
+
axis: AxisInt | None = None,
|
|
490
|
+
skipna: bool = True,
|
|
491
|
+
min_count: int = 0,
|
|
492
|
+
**kwargs,
|
|
493
|
+
) -> Scalar:
|
|
494
|
+
nv.validate_sum((), kwargs)
|
|
495
|
+
result = nanops.nansum(
|
|
496
|
+
self._ndarray, axis=axis, skipna=skipna, min_count=min_count
|
|
497
|
+
)
|
|
498
|
+
return self._wrap_reduction_result(axis, result)
|
|
499
|
+
|
|
500
|
+
def prod(
|
|
501
|
+
self,
|
|
502
|
+
*,
|
|
503
|
+
axis: AxisInt | None = None,
|
|
504
|
+
skipna: bool = True,
|
|
505
|
+
min_count: int = 0,
|
|
506
|
+
**kwargs,
|
|
507
|
+
) -> Scalar:
|
|
508
|
+
nv.validate_prod((), kwargs)
|
|
509
|
+
result = nanops.nanprod(
|
|
510
|
+
self._ndarray, axis=axis, skipna=skipna, min_count=min_count
|
|
511
|
+
)
|
|
512
|
+
return self._wrap_reduction_result(axis, result)
|
|
513
|
+
|
|
514
|
+
def mean(
|
|
515
|
+
self,
|
|
516
|
+
*,
|
|
517
|
+
axis: AxisInt | None = None,
|
|
518
|
+
dtype: NpDtype | None = None,
|
|
519
|
+
out=None,
|
|
520
|
+
keepdims: bool = False,
|
|
521
|
+
skipna: bool = True,
|
|
522
|
+
):
|
|
523
|
+
nv.validate_mean((), {"dtype": dtype, "out": out, "keepdims": keepdims})
|
|
524
|
+
result = nanops.nanmean(self._ndarray, axis=axis, skipna=skipna)
|
|
525
|
+
return self._wrap_reduction_result(axis, result)
|
|
526
|
+
|
|
527
|
+
def median(
|
|
528
|
+
self,
|
|
529
|
+
*,
|
|
530
|
+
axis: AxisInt | None = None,
|
|
531
|
+
out=None,
|
|
532
|
+
overwrite_input: bool = False,
|
|
533
|
+
keepdims: bool = False,
|
|
534
|
+
skipna: bool = True,
|
|
535
|
+
):
|
|
536
|
+
nv.validate_median(
|
|
537
|
+
(), {"out": out, "overwrite_input": overwrite_input, "keepdims": keepdims}
|
|
538
|
+
)
|
|
539
|
+
result = nanops.nanmedian(self._ndarray, axis=axis, skipna=skipna)
|
|
540
|
+
return self._wrap_reduction_result(axis, result)
|
|
541
|
+
|
|
542
|
+
def std(
|
|
543
|
+
self,
|
|
544
|
+
*,
|
|
545
|
+
axis: AxisInt | None = None,
|
|
546
|
+
dtype: NpDtype | None = None,
|
|
547
|
+
out=None,
|
|
548
|
+
ddof: int = 1,
|
|
549
|
+
keepdims: bool = False,
|
|
550
|
+
skipna: bool = True,
|
|
551
|
+
):
|
|
552
|
+
nv.validate_stat_ddof_func(
|
|
553
|
+
(), {"dtype": dtype, "out": out, "keepdims": keepdims}, fname="std"
|
|
554
|
+
)
|
|
555
|
+
result = nanops.nanstd(self._ndarray, axis=axis, skipna=skipna, ddof=ddof)
|
|
556
|
+
return self._wrap_reduction_result(axis, result)
|
|
557
|
+
|
|
558
|
+
def var(
|
|
559
|
+
self,
|
|
560
|
+
*,
|
|
561
|
+
axis: AxisInt | None = None,
|
|
562
|
+
dtype: NpDtype | None = None,
|
|
563
|
+
out=None,
|
|
564
|
+
ddof: int = 1,
|
|
565
|
+
keepdims: bool = False,
|
|
566
|
+
skipna: bool = True,
|
|
567
|
+
):
|
|
568
|
+
nv.validate_stat_ddof_func(
|
|
569
|
+
(), {"dtype": dtype, "out": out, "keepdims": keepdims}, fname="var"
|
|
570
|
+
)
|
|
571
|
+
result = nanops.nanvar(self._ndarray, axis=axis, skipna=skipna, ddof=ddof)
|
|
572
|
+
return self._wrap_reduction_result(axis, result)
|
|
573
|
+
|
|
574
|
+
def sem(
|
|
575
|
+
self,
|
|
576
|
+
*,
|
|
577
|
+
axis: AxisInt | None = None,
|
|
578
|
+
dtype: NpDtype | None = None,
|
|
579
|
+
out=None,
|
|
580
|
+
ddof: int = 1,
|
|
581
|
+
keepdims: bool = False,
|
|
582
|
+
skipna: bool = True,
|
|
583
|
+
):
|
|
584
|
+
nv.validate_stat_ddof_func(
|
|
585
|
+
(), {"dtype": dtype, "out": out, "keepdims": keepdims}, fname="sem"
|
|
586
|
+
)
|
|
587
|
+
result = nanops.nansem(self._ndarray, axis=axis, skipna=skipna, ddof=ddof)
|
|
588
|
+
return self._wrap_reduction_result(axis, result)
|
|
589
|
+
|
|
590
|
+
def kurt(
|
|
591
|
+
self,
|
|
592
|
+
*,
|
|
593
|
+
axis: AxisInt | None = None,
|
|
594
|
+
dtype: NpDtype | None = None,
|
|
595
|
+
out=None,
|
|
596
|
+
keepdims: bool = False,
|
|
597
|
+
skipna: bool = True,
|
|
598
|
+
):
|
|
599
|
+
nv.validate_stat_ddof_func(
|
|
600
|
+
(), {"dtype": dtype, "out": out, "keepdims": keepdims}, fname="kurt"
|
|
601
|
+
)
|
|
602
|
+
result = nanops.nankurt(self._ndarray, axis=axis, skipna=skipna)
|
|
603
|
+
return self._wrap_reduction_result(axis, result)
|
|
604
|
+
|
|
605
|
+
def skew(
|
|
606
|
+
self,
|
|
607
|
+
*,
|
|
608
|
+
axis: AxisInt | None = None,
|
|
609
|
+
dtype: NpDtype | None = None,
|
|
610
|
+
out=None,
|
|
611
|
+
keepdims: bool = False,
|
|
612
|
+
skipna: bool = True,
|
|
613
|
+
):
|
|
614
|
+
nv.validate_stat_ddof_func(
|
|
615
|
+
(), {"dtype": dtype, "out": out, "keepdims": keepdims}, fname="skew"
|
|
616
|
+
)
|
|
617
|
+
result = nanops.nanskew(self._ndarray, axis=axis, skipna=skipna)
|
|
618
|
+
return self._wrap_reduction_result(axis, result)
|
|
619
|
+
|
|
620
|
+
# ------------------------------------------------------------------------
|
|
621
|
+
# Additional Methods
|
|
622
|
+
|
|
623
|
+
def to_numpy(
|
|
624
|
+
self,
|
|
625
|
+
dtype: npt.DTypeLike | None = None,
|
|
626
|
+
copy: bool = False,
|
|
627
|
+
na_value: object = lib.no_default,
|
|
628
|
+
) -> np.ndarray:
|
|
629
|
+
if na_value is not lib.no_default and (mask := self.isna()).any():
|
|
630
|
+
result = self._ndarray.copy()
|
|
631
|
+
result[mask] = na_value
|
|
632
|
+
else:
|
|
633
|
+
result = self._ndarray
|
|
634
|
+
if not copy and self._readonly:
|
|
635
|
+
result = result.view()
|
|
636
|
+
result.flags.writeable = False
|
|
637
|
+
|
|
638
|
+
result = np.asarray(result, dtype=dtype)
|
|
639
|
+
|
|
640
|
+
if copy and result is self._ndarray:
|
|
641
|
+
result = result.copy()
|
|
642
|
+
|
|
643
|
+
return result
|
|
644
|
+
|
|
645
|
+
# ------------------------------------------------------------------------
|
|
646
|
+
# Ops
|
|
647
|
+
|
|
648
|
+
def __invert__(self) -> NumpyExtensionArray:
|
|
649
|
+
return type(self)(~self._ndarray)
|
|
650
|
+
|
|
651
|
+
def __neg__(self) -> NumpyExtensionArray:
|
|
652
|
+
return type(self)(-self._ndarray)
|
|
653
|
+
|
|
654
|
+
def __pos__(self) -> NumpyExtensionArray:
|
|
655
|
+
return type(self)(+self._ndarray)
|
|
656
|
+
|
|
657
|
+
def __abs__(self) -> NumpyExtensionArray:
|
|
658
|
+
return type(self)(abs(self._ndarray))
|
|
659
|
+
|
|
660
|
+
def _cmp_method(self, other, op):
|
|
661
|
+
if isinstance(other, NumpyExtensionArray):
|
|
662
|
+
other = other._ndarray
|
|
663
|
+
|
|
664
|
+
other = ops.maybe_prepare_scalar_for_op(other, (len(self),))
|
|
665
|
+
pd_op = ops.get_array_op(op)
|
|
666
|
+
other = ensure_wrapped_if_datetimelike(other)
|
|
667
|
+
result = pd_op(self._ndarray, other)
|
|
668
|
+
|
|
669
|
+
if op is divmod or op is ops.rdivmod:
|
|
670
|
+
a, b = result
|
|
671
|
+
if isinstance(a, np.ndarray):
|
|
672
|
+
# for e.g. op vs TimedeltaArray, we may already
|
|
673
|
+
# have an ExtensionArray, in which case we do not wrap
|
|
674
|
+
return self._wrap_ndarray_result(a), self._wrap_ndarray_result(b)
|
|
675
|
+
return a, b
|
|
676
|
+
|
|
677
|
+
if isinstance(result, np.ndarray):
|
|
678
|
+
# for e.g. multiplication vs TimedeltaArray, we may already
|
|
679
|
+
# have an ExtensionArray, in which case we do not wrap
|
|
680
|
+
return self._wrap_ndarray_result(result)
|
|
681
|
+
return result
|
|
682
|
+
|
|
683
|
+
_arith_method = _cmp_method
|
|
684
|
+
|
|
685
|
+
def _wrap_ndarray_result(self, result: np.ndarray):
|
|
686
|
+
# If we have timedelta64[ns] result, return a TimedeltaArray instead
|
|
687
|
+
# of a NumpyExtensionArray
|
|
688
|
+
if result.dtype.kind == "m" and is_supported_dtype(result.dtype):
|
|
689
|
+
from pandas.core.arrays import TimedeltaArray
|
|
690
|
+
|
|
691
|
+
return TimedeltaArray._simple_new(result, dtype=result.dtype)
|
|
692
|
+
return type(self)(result)
|
|
693
|
+
|
|
694
|
+
def _formatter(self, boxed: bool = False) -> Callable[[Any], str | None]:
|
|
695
|
+
# NEP 51: https://github.com/numpy/numpy/pull/22449
|
|
696
|
+
if self.dtype.kind in "SU":
|
|
697
|
+
return "'{}'".format
|
|
698
|
+
elif self.dtype == "object":
|
|
699
|
+
return repr
|
|
700
|
+
else:
|
|
701
|
+
return str
|