@backthread/extractor 0.1.0
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/LICENSE +21 -0
- package/README.md +83 -0
- package/dist/cluster/domain-grouping.d.ts +113 -0
- package/dist/cluster/domain-grouping.d.ts.map +1 -0
- package/dist/cluster/domain-grouping.js +277 -0
- package/dist/cluster/domain-grouping.js.map +1 -0
- package/dist/cluster/grouping-gate.d.ts +54 -0
- package/dist/cluster/grouping-gate.d.ts.map +1 -0
- package/dist/cluster/grouping-gate.js +0 -0
- package/dist/cluster/grouping-gate.js.map +1 -0
- package/dist/cluster/louvain.d.ts +88 -0
- package/dist/cluster/louvain.d.ts.map +1 -0
- package/dist/cluster/louvain.js +674 -0
- package/dist/cluster/louvain.js.map +1 -0
- package/dist/cluster/overrides.d.ts +19 -0
- package/dist/cluster/overrides.d.ts.map +1 -0
- package/dist/cluster/overrides.js +32 -0
- package/dist/cluster/overrides.js.map +1 -0
- package/dist/cluster/subsystem.d.ts +45 -0
- package/dist/cluster/subsystem.d.ts.map +1 -0
- package/dist/cluster/subsystem.js +299 -0
- package/dist/cluster/subsystem.js.map +1 -0
- package/dist/cluster/workspaces.d.ts +64 -0
- package/dist/cluster/workspaces.d.ts.map +1 -0
- package/dist/cluster/workspaces.js +739 -0
- package/dist/cluster/workspaces.js.map +1 -0
- package/dist/extract.d.ts +52 -0
- package/dist/extract.d.ts.map +1 -0
- package/dist/extract.js +48 -0
- package/dist/extract.js.map +1 -0
- package/dist/framework/celery/celery.d.ts +17 -0
- package/dist/framework/celery/celery.d.ts.map +1 -0
- package/dist/framework/celery/celery.js +524 -0
- package/dist/framework/celery/celery.js.map +1 -0
- package/dist/framework/contribute-step.d.ts +38 -0
- package/dist/framework/contribute-step.d.ts.map +1 -0
- package/dist/framework/contribute-step.js +403 -0
- package/dist/framework/contribute-step.js.map +1 -0
- package/dist/framework/detect-step.d.ts +8 -0
- package/dist/framework/detect-step.d.ts.map +1 -0
- package/dist/framework/detect-step.js +54 -0
- package/dist/framework/detect-step.js.map +1 -0
- package/dist/framework/detect-util.d.ts +24 -0
- package/dist/framework/detect-util.d.ts.map +1 -0
- package/dist/framework/detect-util.js +59 -0
- package/dist/framework/detect-util.js.map +1 -0
- package/dist/framework/django/django.d.ts +22 -0
- package/dist/framework/django/django.d.ts.map +1 -0
- package/dist/framework/django/django.js +940 -0
- package/dist/framework/django/django.js.map +1 -0
- package/dist/framework/fastapi/fastapi.d.ts +27 -0
- package/dist/framework/fastapi/fastapi.d.ts.map +1 -0
- package/dist/framework/fastapi/fastapi.js +477 -0
- package/dist/framework/fastapi/fastapi.js.map +1 -0
- package/dist/framework/faststream/faststream.d.ts +19 -0
- package/dist/framework/faststream/faststream.d.ts.map +1 -0
- package/dist/framework/faststream/faststream.js +765 -0
- package/dist/framework/faststream/faststream.js.map +1 -0
- package/dist/framework/flask/flask.d.ts +17 -0
- package/dist/framework/flask/flask.d.ts.map +1 -0
- package/dist/framework/flask/flask.js +507 -0
- package/dist/framework/flask/flask.js.map +1 -0
- package/dist/framework/graphql/graphql.d.ts +17 -0
- package/dist/framework/graphql/graphql.d.ts.map +1 -0
- package/dist/framework/graphql/graphql.js +708 -0
- package/dist/framework/graphql/graphql.js.map +1 -0
- package/dist/framework/grpc/grpc.d.ts +22 -0
- package/dist/framework/grpc/grpc.d.ts.map +1 -0
- package/dist/framework/grpc/grpc.js +618 -0
- package/dist/framework/grpc/grpc.js.map +1 -0
- package/dist/framework/litestar/litestar.d.ts +17 -0
- package/dist/framework/litestar/litestar.d.ts.map +1 -0
- package/dist/framework/litestar/litestar.js +536 -0
- package/dist/framework/litestar/litestar.js.map +1 -0
- package/dist/framework/nest/nest.d.ts +19 -0
- package/dist/framework/nest/nest.d.ts.map +1 -0
- package/dist/framework/nest/nest.js +613 -0
- package/dist/framework/nest/nest.js.map +1 -0
- package/dist/framework/next/next.d.ts +22 -0
- package/dist/framework/next/next.d.ts.map +1 -0
- package/dist/framework/next/next.js +449 -0
- package/dist/framework/next/next.js.map +1 -0
- package/dist/framework/node/node.d.ts +24 -0
- package/dist/framework/node/node.d.ts.map +1 -0
- package/dist/framework/node/node.js +1009 -0
- package/dist/framework/node/node.js.map +1 -0
- package/dist/framework/orchestrator/orchestrator.d.ts +34 -0
- package/dist/framework/orchestrator/orchestrator.d.ts.map +1 -0
- package/dist/framework/orchestrator/orchestrator.js +691 -0
- package/dist/framework/orchestrator/orchestrator.js.map +1 -0
- package/dist/framework/orm/orm.d.ts +61 -0
- package/dist/framework/orm/orm.d.ts.map +1 -0
- package/dist/framework/orm/orm.js +620 -0
- package/dist/framework/orm/orm.js.map +1 -0
- package/dist/framework/python/analyze.d.ts +38 -0
- package/dist/framework/python/analyze.d.ts.map +1 -0
- package/dist/framework/python/analyze.js +98 -0
- package/dist/framework/python/analyze.js.map +1 -0
- package/dist/framework/python/py-ast.d.ts +130 -0
- package/dist/framework/python/py-ast.d.ts.map +1 -0
- package/dist/framework/python/py-ast.js +344 -0
- package/dist/framework/python/py-ast.js.map +1 -0
- package/dist/framework/python-orm/python-orm.d.ts +19 -0
- package/dist/framework/python-orm/python-orm.d.ts.map +1 -0
- package/dist/framework/python-orm/python-orm.js +516 -0
- package/dist/framework/python-orm/python-orm.js.map +1 -0
- package/dist/framework/react-native/react-native.d.ts +35 -0
- package/dist/framework/react-native/react-native.d.ts.map +1 -0
- package/dist/framework/react-native/react-native.js +1181 -0
- package/dist/framework/react-native/react-native.js.map +1 -0
- package/dist/framework/register.d.ts +2 -0
- package/dist/framework/register.d.ts.map +1 -0
- package/dist/framework/register.js +59 -0
- package/dist/framework/register.js.map +1 -0
- package/dist/framework/registry.d.ts +31 -0
- package/dist/framework/registry.d.ts.map +1 -0
- package/dist/framework/registry.js +70 -0
- package/dist/framework/registry.js.map +1 -0
- package/dist/framework/routing/expo-router.d.ts +31 -0
- package/dist/framework/routing/expo-router.d.ts.map +1 -0
- package/dist/framework/routing/expo-router.js +356 -0
- package/dist/framework/routing/expo-router.js.map +1 -0
- package/dist/framework/routing/index.d.ts +4 -0
- package/dist/framework/routing/index.d.ts.map +1 -0
- package/dist/framework/routing/index.js +16 -0
- package/dist/framework/routing/index.js.map +1 -0
- package/dist/framework/routing/next-router.d.ts +45 -0
- package/dist/framework/routing/next-router.d.ts.map +1 -0
- package/dist/framework/routing/next-router.js +378 -0
- package/dist/framework/routing/next-router.js.map +1 -0
- package/dist/framework/routing/route-tree.d.ts +73 -0
- package/dist/framework/routing/route-tree.d.ts.map +1 -0
- package/dist/framework/routing/route-tree.js +120 -0
- package/dist/framework/routing/route-tree.js.map +1 -0
- package/dist/framework/types.d.ts +230 -0
- package/dist/framework/types.d.ts.map +1 -0
- package/dist/framework/types.js +25 -0
- package/dist/framework/types.js.map +1 -0
- package/dist/graph/cross-language.d.ts +11 -0
- package/dist/graph/cross-language.d.ts.map +1 -0
- package/dist/graph/cross-language.js +123 -0
- package/dist/graph/cross-language.js.map +1 -0
- package/dist/graph/extract.d.ts +13 -0
- package/dist/graph/extract.d.ts.map +1 -0
- package/dist/graph/extract.js +79 -0
- package/dist/graph/extract.js.map +1 -0
- package/dist/graph/file-graph.d.ts +186 -0
- package/dist/graph/file-graph.d.ts.map +1 -0
- package/dist/graph/file-graph.js +427 -0
- package/dist/graph/file-graph.js.map +1 -0
- package/dist/graph/http-callsites.d.ts +14 -0
- package/dist/graph/http-callsites.d.ts.map +1 -0
- package/dist/graph/http-callsites.js +107 -0
- package/dist/graph/http-callsites.js.map +1 -0
- package/dist/graph/incremental.d.ts +122 -0
- package/dist/graph/incremental.d.ts.map +1 -0
- package/dist/graph/incremental.js +448 -0
- package/dist/graph/incremental.js.map +1 -0
- package/dist/graph/language.d.ts +31 -0
- package/dist/graph/language.d.ts.map +1 -0
- package/dist/graph/language.js +146 -0
- package/dist/graph/language.js.map +1 -0
- package/dist/graph/noise-filter.d.ts +46 -0
- package/dist/graph/noise-filter.d.ts.map +1 -0
- package/dist/graph/noise-filter.js +199 -0
- package/dist/graph/noise-filter.js.map +1 -0
- package/dist/graph/python-adapter.d.ts +36 -0
- package/dist/graph/python-adapter.d.ts.map +1 -0
- package/dist/graph/python-adapter.js +402 -0
- package/dist/graph/python-adapter.js.map +1 -0
- package/dist/graph/python-manifest.d.ts +22 -0
- package/dist/graph/python-manifest.d.ts.map +1 -0
- package/dist/graph/python-manifest.js +137 -0
- package/dist/graph/python-manifest.js.map +1 -0
- package/dist/graph/python-stdlib.d.ts +2 -0
- package/dist/graph/python-stdlib.d.ts.map +1 -0
- package/dist/graph/python-stdlib.js +53 -0
- package/dist/graph/python-stdlib.js.map +1 -0
- package/dist/graph/ts-morph-adapter.d.ts +65 -0
- package/dist/graph/ts-morph-adapter.d.ts.map +1 -0
- package/dist/graph/ts-morph-adapter.js +265 -0
- package/dist/graph/ts-morph-adapter.js.map +1 -0
- package/dist/graph/types.d.ts +37 -0
- package/dist/graph/types.d.ts.map +1 -0
- package/dist/graph/types.js +50 -0
- package/dist/graph/types.js.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/infra/aws/aws-parse.d.ts +39 -0
- package/dist/infra/aws/aws-parse.d.ts.map +1 -0
- package/dist/infra/aws/aws-parse.js +149 -0
- package/dist/infra/aws/aws-parse.js.map +1 -0
- package/dist/infra/aws/aws.d.ts +6 -0
- package/dist/infra/aws/aws.d.ts.map +1 -0
- package/dist/infra/aws/aws.js +425 -0
- package/dist/infra/aws/aws.js.map +1 -0
- package/dist/infra/azure/azure-parse.d.ts +73 -0
- package/dist/infra/azure/azure-parse.d.ts.map +1 -0
- package/dist/infra/azure/azure-parse.js +178 -0
- package/dist/infra/azure/azure-parse.js.map +1 -0
- package/dist/infra/azure/azure.d.ts +12 -0
- package/dist/infra/azure/azure.d.ts.map +1 -0
- package/dist/infra/azure/azure.js +673 -0
- package/dist/infra/azure/azure.js.map +1 -0
- package/dist/infra/cloudflare/cloudflare.d.ts +50 -0
- package/dist/infra/cloudflare/cloudflare.d.ts.map +1 -0
- package/dist/infra/cloudflare/cloudflare.js +382 -0
- package/dist/infra/cloudflare/cloudflare.js.map +1 -0
- package/dist/infra/cloudflare/wrangler-parse.d.ts +6 -0
- package/dist/infra/cloudflare/wrangler-parse.d.ts.map +1 -0
- package/dist/infra/cloudflare/wrangler-parse.js +278 -0
- package/dist/infra/cloudflare/wrangler-parse.js.map +1 -0
- package/dist/infra/compose/compose-parse.d.ts +24 -0
- package/dist/infra/compose/compose-parse.d.ts.map +1 -0
- package/dist/infra/compose/compose-parse.js +77 -0
- package/dist/infra/compose/compose-parse.js.map +1 -0
- package/dist/infra/compose/compose.d.ts +12 -0
- package/dist/infra/compose/compose.d.ts.map +1 -0
- package/dist/infra/compose/compose.js +201 -0
- package/dist/infra/compose/compose.js.map +1 -0
- package/dist/infra/convex/convex-parse.d.ts +28 -0
- package/dist/infra/convex/convex-parse.d.ts.map +1 -0
- package/dist/infra/convex/convex-parse.js +74 -0
- package/dist/infra/convex/convex-parse.js.map +1 -0
- package/dist/infra/convex/convex.d.ts +18 -0
- package/dist/infra/convex/convex.d.ts.map +1 -0
- package/dist/infra/convex/convex.js +199 -0
- package/dist/infra/convex/convex.js.map +1 -0
- package/dist/infra/digitalocean/digitalocean.d.ts +33 -0
- package/dist/infra/digitalocean/digitalocean.d.ts.map +1 -0
- package/dist/infra/digitalocean/digitalocean.js +204 -0
- package/dist/infra/digitalocean/digitalocean.js.map +1 -0
- package/dist/infra/firebase/firebase.d.ts +43 -0
- package/dist/infra/firebase/firebase.d.ts.map +1 -0
- package/dist/infra/firebase/firebase.js +271 -0
- package/dist/infra/firebase/firebase.js.map +1 -0
- package/dist/infra/fly/fly-parse.d.ts +52 -0
- package/dist/infra/fly/fly-parse.d.ts.map +1 -0
- package/dist/infra/fly/fly-parse.js +114 -0
- package/dist/infra/fly/fly-parse.js.map +1 -0
- package/dist/infra/fly/fly.d.ts +15 -0
- package/dist/infra/fly/fly.d.ts.map +1 -0
- package/dist/infra/fly/fly.js +265 -0
- package/dist/infra/fly/fly.js.map +1 -0
- package/dist/infra/gcp/gcp-parse.d.ts +24 -0
- package/dist/infra/gcp/gcp-parse.d.ts.map +1 -0
- package/dist/infra/gcp/gcp-parse.js +123 -0
- package/dist/infra/gcp/gcp-parse.js.map +1 -0
- package/dist/infra/gcp/gcp.d.ts +10 -0
- package/dist/infra/gcp/gcp.d.ts.map +1 -0
- package/dist/infra/gcp/gcp.js +502 -0
- package/dist/infra/gcp/gcp.js.map +1 -0
- package/dist/infra/heroku/heroku-parse.d.ts +33 -0
- package/dist/infra/heroku/heroku-parse.d.ts.map +1 -0
- package/dist/infra/heroku/heroku-parse.js +63 -0
- package/dist/infra/heroku/heroku-parse.js.map +1 -0
- package/dist/infra/heroku/heroku.d.ts +24 -0
- package/dist/infra/heroku/heroku.d.ts.map +1 -0
- package/dist/infra/heroku/heroku.js +253 -0
- package/dist/infra/heroku/heroku.js.map +1 -0
- package/dist/infra/image-resolve.d.ts +56 -0
- package/dist/infra/image-resolve.d.ts.map +1 -0
- package/dist/infra/image-resolve.js +229 -0
- package/dist/infra/image-resolve.js.map +1 -0
- package/dist/infra/infra-step.d.ts +39 -0
- package/dist/infra/infra-step.d.ts.map +1 -0
- package/dist/infra/infra-step.js +57 -0
- package/dist/infra/infra-step.js.map +1 -0
- package/dist/infra/k8s/index.d.ts +78 -0
- package/dist/infra/k8s/index.d.ts.map +1 -0
- package/dist/infra/k8s/index.js +251 -0
- package/dist/infra/k8s/index.js.map +1 -0
- package/dist/infra/kamal/kamal-parse.d.ts +23 -0
- package/dist/infra/kamal/kamal-parse.d.ts.map +1 -0
- package/dist/infra/kamal/kamal-parse.js +66 -0
- package/dist/infra/kamal/kamal-parse.js.map +1 -0
- package/dist/infra/kamal/kamal.d.ts +17 -0
- package/dist/infra/kamal/kamal.d.ts.map +1 -0
- package/dist/infra/kamal/kamal.js +162 -0
- package/dist/infra/kamal/kamal.js.map +1 -0
- package/dist/infra/netlify/netlify.d.ts +33 -0
- package/dist/infra/netlify/netlify.d.ts.map +1 -0
- package/dist/infra/netlify/netlify.js +247 -0
- package/dist/infra/netlify/netlify.js.map +1 -0
- package/dist/infra/opentofu/opentofu.d.ts +3 -0
- package/dist/infra/opentofu/opentofu.d.ts.map +1 -0
- package/dist/infra/opentofu/opentofu.js +157 -0
- package/dist/infra/opentofu/opentofu.js.map +1 -0
- package/dist/infra/pulumi/pulumi-parse.d.ts +60 -0
- package/dist/infra/pulumi/pulumi-parse.d.ts.map +1 -0
- package/dist/infra/pulumi/pulumi-parse.js +155 -0
- package/dist/infra/pulumi/pulumi-parse.js.map +1 -0
- package/dist/infra/pulumi/pulumi.d.ts +23 -0
- package/dist/infra/pulumi/pulumi.d.ts.map +1 -0
- package/dist/infra/pulumi/pulumi.js +260 -0
- package/dist/infra/pulumi/pulumi.js.map +1 -0
- package/dist/infra/railway/railway-parse.d.ts +54 -0
- package/dist/infra/railway/railway-parse.d.ts.map +1 -0
- package/dist/infra/railway/railway-parse.js +200 -0
- package/dist/infra/railway/railway-parse.js.map +1 -0
- package/dist/infra/railway/railway.d.ts +19 -0
- package/dist/infra/railway/railway.d.ts.map +1 -0
- package/dist/infra/railway/railway.js +397 -0
- package/dist/infra/railway/railway.js.map +1 -0
- package/dist/infra/register.d.ts +2 -0
- package/dist/infra/register.d.ts.map +1 -0
- package/dist/infra/register.js +81 -0
- package/dist/infra/register.js.map +1 -0
- package/dist/infra/registry.d.ts +64 -0
- package/dist/infra/registry.d.ts.map +1 -0
- package/dist/infra/registry.js +205 -0
- package/dist/infra/registry.js.map +1 -0
- package/dist/infra/relevance.d.ts +16 -0
- package/dist/infra/relevance.d.ts.map +1 -0
- package/dist/infra/relevance.js +132 -0
- package/dist/infra/relevance.js.map +1 -0
- package/dist/infra/render/render-parse.d.ts +76 -0
- package/dist/infra/render/render-parse.d.ts.map +1 -0
- package/dist/infra/render/render-parse.js +155 -0
- package/dist/infra/render/render-parse.js.map +1 -0
- package/dist/infra/render/render.d.ts +11 -0
- package/dist/infra/render/render.d.ts.map +1 -0
- package/dist/infra/render/render.js +303 -0
- package/dist/infra/render/render.js.map +1 -0
- package/dist/infra/sst/sst-parse.d.ts +25 -0
- package/dist/infra/sst/sst-parse.d.ts.map +1 -0
- package/dist/infra/sst/sst-parse.js +45 -0
- package/dist/infra/sst/sst-parse.js.map +1 -0
- package/dist/infra/sst/sst.d.ts +19 -0
- package/dist/infra/sst/sst.d.ts.map +1 -0
- package/dist/infra/sst/sst.js +236 -0
- package/dist/infra/sst/sst.js.map +1 -0
- package/dist/infra/supabase/supabase-parse.d.ts +34 -0
- package/dist/infra/supabase/supabase-parse.d.ts.map +1 -0
- package/dist/infra/supabase/supabase-parse.js +113 -0
- package/dist/infra/supabase/supabase-parse.js.map +1 -0
- package/dist/infra/supabase/supabase.d.ts +15 -0
- package/dist/infra/supabase/supabase.d.ts.map +1 -0
- package/dist/infra/supabase/supabase.js +198 -0
- package/dist/infra/supabase/supabase.js.map +1 -0
- package/dist/infra/terraform/hcl-parse.d.ts +34 -0
- package/dist/infra/terraform/hcl-parse.d.ts.map +1 -0
- package/dist/infra/terraform/hcl-parse.js +203 -0
- package/dist/infra/terraform/hcl-parse.js.map +1 -0
- package/dist/infra/terraform/terraform.d.ts +14 -0
- package/dist/infra/terraform/terraform.d.ts.map +1 -0
- package/dist/infra/terraform/terraform.js +264 -0
- package/dist/infra/terraform/terraform.js.map +1 -0
- package/dist/infra/types.d.ts +151 -0
- package/dist/infra/types.d.ts.map +1 -0
- package/dist/infra/types.js +14 -0
- package/dist/infra/types.js.map +1 -0
- package/dist/infra/vercel/vercel-parse.d.ts +70 -0
- package/dist/infra/vercel/vercel-parse.d.ts.map +1 -0
- package/dist/infra/vercel/vercel-parse.js +194 -0
- package/dist/infra/vercel/vercel-parse.js.map +1 -0
- package/dist/infra/vercel/vercel.d.ts +30 -0
- package/dist/infra/vercel/vercel.d.ts.map +1 -0
- package/dist/infra/vercel/vercel.js +523 -0
- package/dist/infra/vercel/vercel.js.map +1 -0
- package/dist/infra/walk.d.ts +36 -0
- package/dist/infra/walk.d.ts.map +1 -0
- package/dist/infra/walk.js +85 -0
- package/dist/infra/walk.js.map +1 -0
- package/dist/safety.d.ts +13 -0
- package/dist/safety.d.ts.map +1 -0
- package/dist/safety.js +67 -0
- package/dist/safety.js.map +1 -0
- package/dist/types.d.ts +47 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +111 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +35 -0
- package/dist/version.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type CollectedNodes } from './py-ast.js';
|
|
2
|
+
import type { ImportFromNode, ImportNode } from '@zzzen/pyright-internal/dist/parser/parseNodes.js';
|
|
3
|
+
import type { FrameworkContext } from '../types.js';
|
|
4
|
+
/** A Python source file (module or stub). */
|
|
5
|
+
export declare function isPythonFile(language: string): boolean;
|
|
6
|
+
/** Is `fileId` within the adapter's matched root (rootPath '' = whole repo)? */
|
|
7
|
+
export declare function inScope(fileId: string, rootPath: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* A file's `localName → target file id` import map, resolving module paths with
|
|
10
|
+
* the extractor's path-anchored, nested-root-aware `syntacticResolve` (consistent
|
|
11
|
+
* with /988). Handles `import a.b as c`, `from pkg import submod` (prefers
|
|
12
|
+
* the submodule file), and `from pkg import symbol` (the symbol's module file).
|
|
13
|
+
* The tricky, load-bearing piece every Python adapter needs for cross-module edges.
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildImportBindings(fromId: string, imports: ReadonlyArray<ImportNode | ImportFromNode>, internalIds: ReadonlySet<string>, roots: readonly string[]): Map<string, string>;
|
|
16
|
+
/** One in-scope Python file: its collected nodes + its import bindings. */
|
|
17
|
+
export interface ParsedPythonFile {
|
|
18
|
+
nodes: CollectedNodes;
|
|
19
|
+
bindings: Map<string, string>;
|
|
20
|
+
}
|
|
21
|
+
/** The parsed in-scope Python surface an adapter analyzes. */
|
|
22
|
+
export interface PythonScope {
|
|
23
|
+
/** In-scope Python file ids (from the graph, post-noise-filter). */
|
|
24
|
+
pyFiles: string[];
|
|
25
|
+
/** The resolution id set (all in-scope Python files). */
|
|
26
|
+
internalIds: ReadonlySet<string>;
|
|
27
|
+
/** Inferred first-party source roots (nested-package aware). */
|
|
28
|
+
roots: readonly string[];
|
|
29
|
+
/** fileId → parsed nodes + import bindings (unparseable files are omitted). */
|
|
30
|
+
parsed: Map<string, ParsedPythonFile>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Parse every in-scope Python file once and build its import bindings — the
|
|
34
|
+
* common first step of every Python framework adapter's analysis. Reads source
|
|
35
|
+
* server-side (never-store-source); a file that can't be read/parsed is skipped.
|
|
36
|
+
*/
|
|
37
|
+
export declare function parsePythonScope(ctx: FrameworkContext): PythonScope;
|
|
38
|
+
//# sourceMappingURL=analyze.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../../src/framework/python/analyze.ts"],"names":[],"mappings":"AASA,OAAO,EAAiC,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EAEX,MAAM,mDAAmD,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,6CAA6C;AAC7C,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED,gFAAgF;AAChF,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGjE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,aAAa,CAAC,UAAU,GAAG,cAAc,CAAC,EACnD,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAsCrB;AAED,2EAA2E;AAC3E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED,8DAA8D;AAC9D,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,yDAAyD;IACzD,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,gEAAgE;IAChE,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,+EAA+E;IAC/E,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CACvC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,GAAG,WAAW,CAqBnE"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// Shared Python framework-adapter core (+). The reusable helpers the
|
|
2
|
+
// FastAPI adapter established, promoted so the Django / Flask / ORM /
|
|
3
|
+
// Celery / … fleet share ONE cross-module resolver + ONE parse-scope setup
|
|
4
|
+
// instead of each reinventing them. All install-free + deterministic (pure
|
|
5
|
+
// syntactic Pyright parse via ./py-ast.js; never executes repo code).
|
|
6
|
+
import { readFileSync } from 'node:fs';
|
|
7
|
+
import { join } from 'node:path';
|
|
8
|
+
import { inferSourceRoots, syntacticResolve } from '../../graph/python-adapter.js';
|
|
9
|
+
import { collectNodes, parsePython, PN } from './py-ast.js';
|
|
10
|
+
/** A Python source file (module or stub). */
|
|
11
|
+
export function isPythonFile(language) {
|
|
12
|
+
return language === 'py' || language === 'pyi';
|
|
13
|
+
}
|
|
14
|
+
/** Is `fileId` within the adapter's matched root (rootPath '' = whole repo)? */
|
|
15
|
+
export function inScope(fileId, rootPath) {
|
|
16
|
+
if (rootPath === '')
|
|
17
|
+
return true;
|
|
18
|
+
return fileId === rootPath || fileId.startsWith(`${rootPath}/`);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A file's `localName → target file id` import map, resolving module paths with
|
|
22
|
+
* the extractor's path-anchored, nested-root-aware `syntacticResolve` (consistent
|
|
23
|
+
* with /988). Handles `import a.b as c`, `from pkg import submod` (prefers
|
|
24
|
+
* the submodule file), and `from pkg import symbol` (the symbol's module file).
|
|
25
|
+
* The tricky, load-bearing piece every Python adapter needs for cross-module edges.
|
|
26
|
+
*/
|
|
27
|
+
export function buildImportBindings(fromId, imports, internalIds, roots) {
|
|
28
|
+
const map = new Map();
|
|
29
|
+
for (const imp of imports) {
|
|
30
|
+
if (imp.nodeType === PN.Import) {
|
|
31
|
+
// `import a.b.c as d` → d; `import a.b` → the top package name `a`. LIMITATION
|
|
32
|
+
// (accepted): a non-aliased `import a.b.c` binds only `a` (→ its __init__), so a
|
|
33
|
+
// later `a.b.c.x` access resolves imprecisely — rare; the `from … import x`
|
|
34
|
+
// forms below resolve exactly.
|
|
35
|
+
for (const entry of imp.d.list) {
|
|
36
|
+
const parts = entry.d.module.d.nameParts.map((p) => p.d.value);
|
|
37
|
+
if (parts.length === 0)
|
|
38
|
+
continue;
|
|
39
|
+
const dotted = parts.join('.');
|
|
40
|
+
const local = entry.d.alias ? entry.d.alias.d.value : parts[0];
|
|
41
|
+
const target = entry.d.alias
|
|
42
|
+
? syntacticResolve(dotted, fromId, internalIds, roots)
|
|
43
|
+
: syntacticResolve(parts[0], fromId, internalIds, roots);
|
|
44
|
+
if (target)
|
|
45
|
+
map.set(local, target);
|
|
46
|
+
}
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (imp.nodeType !== PN.ImportFrom)
|
|
50
|
+
continue;
|
|
51
|
+
const from = imp;
|
|
52
|
+
const dots = '.'.repeat(from.d.module.d.leadingDots);
|
|
53
|
+
const body = from.d.module.d.nameParts.map((p) => p.d.value).join('.');
|
|
54
|
+
const modulePrefix = dots + body; // '' | 'app.api.routes' | '.routers' | '.'
|
|
55
|
+
for (const spec of from.d.imports) {
|
|
56
|
+
const imported = spec.d.name.d.value;
|
|
57
|
+
const local = spec.d.alias ? spec.d.alias.d.value : imported;
|
|
58
|
+
// Prefer the SUBMODULE resolution (`from app.api.routes import users` →
|
|
59
|
+
// users.py); fall back to the MODULE (`from …users import symbol` → users.py).
|
|
60
|
+
const submodule = modulePrefix ? `${modulePrefix}.${imported}` : imported;
|
|
61
|
+
const target = syntacticResolve(submodule, fromId, internalIds, roots) ??
|
|
62
|
+
(modulePrefix ? syntacticResolve(modulePrefix, fromId, internalIds, roots) : undefined);
|
|
63
|
+
if (target)
|
|
64
|
+
map.set(local, target);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return map;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Parse every in-scope Python file once and build its import bindings — the
|
|
71
|
+
* common first step of every Python framework adapter's analysis. Reads source
|
|
72
|
+
* server-side (never-store-source); a file that can't be read/parsed is skipped.
|
|
73
|
+
*/
|
|
74
|
+
export function parsePythonScope(ctx) {
|
|
75
|
+
const { repoDir, rootPath, graph } = ctx;
|
|
76
|
+
const pyFiles = graph.files
|
|
77
|
+
.filter((f) => isPythonFile(f.language) && inScope(f.id, rootPath))
|
|
78
|
+
.map((f) => f.id);
|
|
79
|
+
const internalIds = new Set(pyFiles);
|
|
80
|
+
const roots = inferSourceRoots(internalIds);
|
|
81
|
+
const parsed = new Map();
|
|
82
|
+
for (const id of pyFiles) {
|
|
83
|
+
let text;
|
|
84
|
+
try {
|
|
85
|
+
text = readFileSync(join(repoDir, id), 'utf8');
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const tree = parsePython(text);
|
|
91
|
+
if (!tree)
|
|
92
|
+
continue;
|
|
93
|
+
const nodes = collectNodes(tree);
|
|
94
|
+
parsed.set(id, { nodes, bindings: buildImportBindings(id, nodes.imports, internalIds, roots) });
|
|
95
|
+
}
|
|
96
|
+
return { pyFiles, internalIds, roots, parsed };
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=analyze.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.js","sourceRoot":"","sources":["../../../src/framework/python/analyze.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sEAAsE;AACtE,2EAA2E;AAC3E,2EAA2E;AAC3E,sEAAsE;AAEtE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,EAAE,EAAuB,MAAM,aAAa,CAAC;AAQjF,6CAA6C;AAC7C,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,OAAO,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,KAAK,CAAC;AACjD,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,OAAO,CAAC,MAAc,EAAE,QAAgB;IACtD,IAAI,QAAQ,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IACjC,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,QAAQ,GAAG,CAAC,CAAC;AAClE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAc,EACd,OAAmD,EACnD,WAAgC,EAChC,KAAwB;IAExB,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IACtC,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,IAAK,GAAiB,CAAC,QAAQ,KAAK,EAAE,CAAC,MAAM,EAAE,CAAC;YAC9C,+EAA+E;YAC/E,iFAAiF;YACjF,4EAA4E;YAC5E,+BA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AAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;SAClE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACpB,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,IAAI,GAAG,EAA4B,CAAC;IACnD,KAAK,MAAM,EAAE,IAAI,OAAO,EAAE,CAAC;QACzB,IAAI,IAAY,CAAC;QACjB,IAAI,CAAC;YACH,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QACjD,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QACD,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI;YAAE,SAAS;QACpB,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,mBAAmB,CAAC,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;IAClG,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { AssignmentNode, BinaryOperationNode, CallNode, ClassNode, ExpressionNode, FunctionNode, ImportFromNode, ImportNode, ModuleNode, ParseNode, TypeAnnotationNode } from '@zzzen/pyright-internal/dist/parser/parseNodes.js';
|
|
2
|
+
export declare const PN: {
|
|
3
|
+
readonly Assignment: 3;
|
|
4
|
+
readonly BinaryOperation: 7;
|
|
5
|
+
readonly Call: 9;
|
|
6
|
+
readonly Class: 10;
|
|
7
|
+
readonly Constant: 14;
|
|
8
|
+
readonly Dictionary: 18;
|
|
9
|
+
readonly DictionaryKeyEntry: 20;
|
|
10
|
+
readonly Import: 23;
|
|
11
|
+
readonly Index: 27;
|
|
12
|
+
readonly ImportFrom: 25;
|
|
13
|
+
readonly Function: 31;
|
|
14
|
+
readonly List: 34;
|
|
15
|
+
readonly MemberAccess: 35;
|
|
16
|
+
readonly Module: 36;
|
|
17
|
+
readonly Name: 38;
|
|
18
|
+
readonly StatementList: 47;
|
|
19
|
+
readonly StringList: 48;
|
|
20
|
+
readonly String: 49;
|
|
21
|
+
readonly TypeAnnotation: 54;
|
|
22
|
+
};
|
|
23
|
+
/** A repo file's collected top-level-relevant nodes (recursive — nested `if:`
|
|
24
|
+
* blocks matter, e.g. an env-gated `include_router`). `classes` +
|
|
25
|
+
* `typeAnnotations` were added for the ORM entity pass; `binaryOps`
|
|
26
|
+
* collects EVERY binary-operation node (a >> b, a << b, a + b, …) so
|
|
27
|
+
* an adapter that reads operator wiring — the Airflow `a >> b` / `a << b`
|
|
28
|
+
* task-dependency DSL — can interpret it without a second parse. Existing
|
|
29
|
+
* consumers read only the fields they need, so each addition is backward-safe. */
|
|
30
|
+
export interface CollectedNodes {
|
|
31
|
+
assignments: AssignmentNode[];
|
|
32
|
+
functions: FunctionNode[];
|
|
33
|
+
calls: CallNode[];
|
|
34
|
+
imports: (ImportNode | ImportFromNode)[];
|
|
35
|
+
classes: ClassNode[];
|
|
36
|
+
typeAnnotations: TypeAnnotationNode[];
|
|
37
|
+
binaryOps: BinaryOperationNode[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Parse one Python file's text into a Pyright module node, or undefined on any
|
|
41
|
+
* parse failure (degrade-not-throw — one unparseable file must never sink the
|
|
42
|
+
* adapter). The `Module` node-type canary fails loud if the pinned enum drifts.
|
|
43
|
+
*/
|
|
44
|
+
export declare function parsePython(text: string): ModuleNode | undefined;
|
|
45
|
+
/** Recursively collect assignments / functions / calls / imports from a module. */
|
|
46
|
+
export declare function collectNodes(tree: ModuleNode): CollectedNodes;
|
|
47
|
+
/** A Name node's identifier value, or undefined. */
|
|
48
|
+
export declare function nameValue(n: ParseNode | undefined): string | undefined;
|
|
49
|
+
/** A pure Name / MemberAccess chain → `{ root, path }` (`a.b.c` → root `a`, path
|
|
50
|
+
* `['b','c']`); undefined if the expression isn't a plain dotted-name chain. */
|
|
51
|
+
export declare function memberChain(n: ParseNode | undefined): {
|
|
52
|
+
root: string;
|
|
53
|
+
path: string[];
|
|
54
|
+
} | undefined;
|
|
55
|
+
/** The callee chain of a call expression (`x.include_router(...)` → root `x`,
|
|
56
|
+
* path `['include_router']`); undefined for a non-dotted-name callee. */
|
|
57
|
+
export declare function callCallee(call: CallNode): {
|
|
58
|
+
root: string;
|
|
59
|
+
path: string[];
|
|
60
|
+
} | undefined;
|
|
61
|
+
/** A call's callee, IF the whole callee is itself a call (`Foo()(...)`). */
|
|
62
|
+
export declare function calleeCall(call: CallNode): CallNode | undefined;
|
|
63
|
+
/** The concatenated value of a string-literal expression (adjacent literals
|
|
64
|
+
* join; f-strings are skipped), or undefined if it isn't a plain string. */
|
|
65
|
+
export declare function stringValue(expr: ExpressionNode | undefined): string | undefined;
|
|
66
|
+
/** The value expression of a call's keyword argument `name=…`, or undefined. */
|
|
67
|
+
export declare function keywordArg(call: CallNode, name: string): ExpressionNode | undefined;
|
|
68
|
+
/** A call's positional argument value expressions, in order. */
|
|
69
|
+
export declare function positionalArgs(call: CallNode): ExpressionNode[];
|
|
70
|
+
/** The first string literal in a list-literal expression (`["users", …]` →
|
|
71
|
+
* `'users'`), or undefined if it isn't a list or its first item isn't a string. */
|
|
72
|
+
export declare function firstListString(expr: ExpressionNode | undefined): string | undefined;
|
|
73
|
+
/** A class definition's name identifier, or undefined. */
|
|
74
|
+
export declare function className(cls: ClassNode): string | undefined;
|
|
75
|
+
/** A class's POSITIONAL base-class expressions as `{ root, path }` chains
|
|
76
|
+
* (`class X(models.Model)` → `{ root:'models', path:['Model'] }`); keyword
|
|
77
|
+
* arguments (`table=True`, `metaclass=…`) are excluded. Non-dotted-name bases
|
|
78
|
+
* are dropped. */
|
|
79
|
+
export declare function classBaseChains(cls: ClassNode): Array<{
|
|
80
|
+
root: string;
|
|
81
|
+
path: string[];
|
|
82
|
+
}>;
|
|
83
|
+
/** The value expression of a class's keyword argument `name=…` (`table=True`),
|
|
84
|
+
* or undefined. */
|
|
85
|
+
export declare function classKeywordArg(cls: ClassNode, name: string): ExpressionNode | undefined;
|
|
86
|
+
/** Walk a class BODY (its suite) into the same collected-node shape — the
|
|
87
|
+
* per-class attribute assignments / field calls / `Mapped[…]` annotations an
|
|
88
|
+
* entity detector inspects. */
|
|
89
|
+
export declare function collectClassBody(cls: ClassNode): CollectedNodes;
|
|
90
|
+
/** The FunctionNodes declared DIRECTLY in a class body (its methods) — NOT nested
|
|
91
|
+
* functions inside those methods, and unlike `collectClassBody().functions` which
|
|
92
|
+
* recurses. Used by the GraphQL adapter to find field-resolver
|
|
93
|
+
* methods without descending into their bodies. */
|
|
94
|
+
export declare function classDirectFunctions(cls: ClassNode): FunctionNode[];
|
|
95
|
+
/** The AssignmentNodes declared DIRECTLY in a class body (its class-level field
|
|
96
|
+
* assignments, e.g. graphene's `user = graphene.Field(User)`) — NOT assignments
|
|
97
|
+
* inside methods (which `collectClassBody().assignments` would include). Bare
|
|
98
|
+
* annotations (`user: User` with no `=`) are not assignments and are excluded. */
|
|
99
|
+
export declare function classDirectAssignments(cls: ClassNode): AssignmentNode[];
|
|
100
|
+
/** The head of a (possibly subscripted) type expression as a `{ root, path }`
|
|
101
|
+
* chain: `Mapped[list["X"]]` → the `Mapped` chain; a plain `Foo`/`a.Foo` → its
|
|
102
|
+
* own chain. Undefined when the head isn't a dotted-name. */
|
|
103
|
+
export declare function annotationChain(expr: ExpressionNode | undefined): {
|
|
104
|
+
root: string;
|
|
105
|
+
path: string[];
|
|
106
|
+
} | undefined;
|
|
107
|
+
/** The subscript argument value expressions of an index expression
|
|
108
|
+
* (`Mapped[list["X"]]` → `[ list["X"] ]`), or `[]` when it isn't a subscript. */
|
|
109
|
+
export declare function subscriptArgs(expr: ExpressionNode | undefined): ExpressionNode[];
|
|
110
|
+
/** True iff `expr` is the boolean literal `True` (for `table=True`). */
|
|
111
|
+
export declare function isTrueConstant(expr: ExpressionNode | undefined): boolean;
|
|
112
|
+
/** A list-literal expression's item expressions (`[a, b.c, D()]` → the three
|
|
113
|
+
* item nodes), or `[]` if it isn't a list. */
|
|
114
|
+
export declare function listItems(expr: ExpressionNode | undefined): ExpressionNode[];
|
|
115
|
+
/** The RHS value expression of a DIRECT class-body assignment (`class C: path =
|
|
116
|
+
* "/x"` → the `"/x"` expr for name `'path'`), or undefined. Only the class's own
|
|
117
|
+
* top-level body is inspected (not nested classes/methods); the first match wins. */
|
|
118
|
+
export declare function classAttr(cls: ClassNode, name: string): ExpressionNode | undefined;
|
|
119
|
+
/** The value of a DIRECT class-body STRING assignment (`class C: path = "/x"` →
|
|
120
|
+
* `'/x'`), or undefined if absent / not a plain string literal. */
|
|
121
|
+
export declare function classAttrString(cls: ClassNode, name: string): string | undefined;
|
|
122
|
+
/** A dict literal's plain `key: value` entries, in source order (`{**spread}`
|
|
123
|
+
* expand entries are skipped). Empty for a non-dict expression. The key/value
|
|
124
|
+
* are raw expressions — resolve string keys/values with `stringValue`. Used by
|
|
125
|
+
* the Celery adapter to read a `beat_schedule = {…}` config statically. */
|
|
126
|
+
export declare function dictEntries(expr: ExpressionNode | undefined): Array<{
|
|
127
|
+
keyExpr: ExpressionNode;
|
|
128
|
+
valueExpr: ExpressionNode;
|
|
129
|
+
}>;
|
|
130
|
+
//# sourceMappingURL=py-ast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"py-ast.d.ts","sourceRoot":"","sources":["../../../src/framework/python/py-ast.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,cAAc,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AAC,IAAI,EAAE,cAAc,GAAG,SAAS,GAAG,cAAc,EAAE,CAGhF;AAED,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,GAAG,OAAO,CAMxE;AAMD;+CAC+C;AAC/C,wBAAgB,SAAS,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,GAAG,cAAc,EAAE,CAG5E;AAED;;sFAEsF;AACtF,wBAAgB,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAclF;AAED;oEACoE;AACpE,wBAAgB,eAAe,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEhF;AAED;;;4EAG4E;AAC5E,wBAAgB,WAAW,CACzB,IAAI,EAAE,cAAc,GAAG,SAAS,GAC/B,KAAK,CAAC;IAAE,OAAO,EAAE,cAAc,CAAC;IAAC,SAAS,EAAE,cAAc,CAAA;CAAE,CAAC,CAS/D"}
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
// minimal Pyright parse-tree helpers for the FastAPI adapter.
|
|
2
|
+
//
|
|
3
|
+
// Drives Pyright's PARSER ONLY — a pure, install-free SYNTACTIC parse of one
|
|
4
|
+
// file's text (no Program, no binding, no type checker, no venv, no subprocess,
|
|
5
|
+
// never executes repo code). This mirrors 's pure-static discipline and
|
|
6
|
+
// reuses Pyright's own parser rather than a second grammar (the tree-sitter WASM
|
|
7
|
+
// dead-end, ) — no native binary, so it runs identically local + in the
|
|
8
|
+
// destroy-on-exit container.
|
|
9
|
+
//
|
|
10
|
+
// `ParseNodeType` is a `const enum` (erased from the .d.ts, and unimportable under
|
|
11
|
+
// isolatedModules), so — exactly like 's `IMPORT_TYPE_LOCAL` — we PIN the
|
|
12
|
+
// handful of node-type values we branch on. `parsePython()` asserts the module
|
|
13
|
+
// node's type equals the pinned `Module`, a fail-loud canary if a future exactly-
|
|
14
|
+
// pinned pyright bump ever renumbers the enum.
|
|
15
|
+
import { Parser, ParseOptions } from '@zzzen/pyright-internal/dist/parser/parser.js';
|
|
16
|
+
import { DiagnosticSink } from '@zzzen/pyright-internal/dist/common/diagnosticSink.js';
|
|
17
|
+
import { ParseTreeWalker } from '@zzzen/pyright-internal/dist/analyzer/parseTreeWalker.js';
|
|
18
|
+
// Pinned ParseNodeType values (parser/parseNodes.js). The dep is pinned EXACTLY,
|
|
19
|
+
// so these are stable; the canary in parsePython() catches any drift.
|
|
20
|
+
export const PN = {
|
|
21
|
+
Assignment: 3,
|
|
22
|
+
BinaryOperation: 7,
|
|
23
|
+
Call: 9,
|
|
24
|
+
Class: 10,
|
|
25
|
+
Constant: 14,
|
|
26
|
+
Dictionary: 18,
|
|
27
|
+
DictionaryKeyEntry: 20,
|
|
28
|
+
Import: 23,
|
|
29
|
+
Index: 27,
|
|
30
|
+
ImportFrom: 25,
|
|
31
|
+
Function: 31,
|
|
32
|
+
List: 34,
|
|
33
|
+
MemberAccess: 35,
|
|
34
|
+
Module: 36,
|
|
35
|
+
Name: 38,
|
|
36
|
+
StatementList: 47,
|
|
37
|
+
StringList: 48,
|
|
38
|
+
String: 49,
|
|
39
|
+
TypeAnnotation: 54,
|
|
40
|
+
};
|
|
41
|
+
// KeywordType values (tokenizerTypes.js) for the boolean constant literals — used
|
|
42
|
+
// to read `table=True` (SQLModel) statically. Pinned like the ParseNodeType set.
|
|
43
|
+
const KW_TRUE = 33;
|
|
44
|
+
class NodeCollector extends ParseTreeWalker {
|
|
45
|
+
out = {
|
|
46
|
+
assignments: [],
|
|
47
|
+
functions: [],
|
|
48
|
+
calls: [],
|
|
49
|
+
imports: [],
|
|
50
|
+
classes: [],
|
|
51
|
+
typeAnnotations: [],
|
|
52
|
+
binaryOps: [],
|
|
53
|
+
};
|
|
54
|
+
visitAssignment(node) {
|
|
55
|
+
this.out.assignments.push(node);
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
visitFunction(node) {
|
|
59
|
+
this.out.functions.push(node);
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
visitCall(node) {
|
|
63
|
+
this.out.calls.push(node);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
visitImport(node) {
|
|
67
|
+
this.out.imports.push(node);
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
visitImportFrom(node) {
|
|
71
|
+
this.out.imports.push(node);
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
visitClass(node) {
|
|
75
|
+
this.out.classes.push(node);
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
visitTypeAnnotation(node) {
|
|
79
|
+
this.out.typeAnnotations.push(node);
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
visitBinaryOperation(node) {
|
|
83
|
+
this.out.binaryOps.push(node);
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Parse one Python file's text into a Pyright module node, or undefined on any
|
|
89
|
+
* parse failure (degrade-not-throw — one unparseable file must never sink the
|
|
90
|
+
* adapter). The `Module` node-type canary fails loud if the pinned enum drifts.
|
|
91
|
+
*/
|
|
92
|
+
export function parsePython(text) {
|
|
93
|
+
try {
|
|
94
|
+
const parser = new Parser();
|
|
95
|
+
const result = parser.parseSourceFile(text, new ParseOptions(), new DiagnosticSink());
|
|
96
|
+
const tree = result.parserOutput.parseTree;
|
|
97
|
+
if (!tree || tree.nodeType !== PN.Module) {
|
|
98
|
+
if (tree && tree.nodeType !== PN.Module) {
|
|
99
|
+
throw new Error(`Pyright ParseNodeType pin drift: module node is ${tree.nodeType}, expected ${PN.Module}`);
|
|
100
|
+
}
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
return tree;
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
// A pin-drift canary is a real error worth surfacing; a genuine parse failure
|
|
107
|
+
// is expected noise. Re-throw the canary, swallow the rest.
|
|
108
|
+
if (err instanceof Error && err.message.startsWith('Pyright ParseNodeType pin drift'))
|
|
109
|
+
throw err;
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** Recursively collect assignments / functions / calls / imports from a module. */
|
|
114
|
+
export function collectNodes(tree) {
|
|
115
|
+
const collector = new NodeCollector();
|
|
116
|
+
collector.walk(tree);
|
|
117
|
+
return collector.out;
|
|
118
|
+
}
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
// Typed accessors (all guard on the pinned nodeType, so a wrong-shaped node
|
|
121
|
+
// degrades to undefined rather than throwing).
|
|
122
|
+
function isName(n) {
|
|
123
|
+
return !!n && n.nodeType === PN.Name;
|
|
124
|
+
}
|
|
125
|
+
function isMemberAccess(n) {
|
|
126
|
+
return !!n && n.nodeType === PN.MemberAccess;
|
|
127
|
+
}
|
|
128
|
+
function isCall(n) {
|
|
129
|
+
return !!n && n.nodeType === PN.Call;
|
|
130
|
+
}
|
|
131
|
+
/** A Name node's identifier value, or undefined. */
|
|
132
|
+
export function nameValue(n) {
|
|
133
|
+
return isName(n) ? n.d.value : undefined;
|
|
134
|
+
}
|
|
135
|
+
/** A pure Name / MemberAccess chain → `{ root, path }` (`a.b.c` → root `a`, path
|
|
136
|
+
* `['b','c']`); undefined if the expression isn't a plain dotted-name chain. */
|
|
137
|
+
export function memberChain(n) {
|
|
138
|
+
if (isName(n))
|
|
139
|
+
return { root: n.d.value, path: [] };
|
|
140
|
+
if (isMemberAccess(n)) {
|
|
141
|
+
const base = memberChain(n.d.leftExpr);
|
|
142
|
+
if (!base)
|
|
143
|
+
return undefined;
|
|
144
|
+
return { root: base.root, path: [...base.path, n.d.member.d.value] };
|
|
145
|
+
}
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
/** The callee chain of a call expression (`x.include_router(...)` → root `x`,
|
|
149
|
+
* path `['include_router']`); undefined for a non-dotted-name callee. */
|
|
150
|
+
export function callCallee(call) {
|
|
151
|
+
return memberChain(call.d.leftExpr);
|
|
152
|
+
}
|
|
153
|
+
/** A call's callee, IF the whole callee is itself a call (`Foo()(...)`). */
|
|
154
|
+
export function calleeCall(call) {
|
|
155
|
+
return isCall(call.d.leftExpr) ? call.d.leftExpr : undefined;
|
|
156
|
+
}
|
|
157
|
+
/** The concatenated value of a string-literal expression (adjacent literals
|
|
158
|
+
* join; f-strings are skipped), or undefined if it isn't a plain string. */
|
|
159
|
+
export function stringValue(expr) {
|
|
160
|
+
if (!expr)
|
|
161
|
+
return undefined;
|
|
162
|
+
if (expr.nodeType === PN.StringList) {
|
|
163
|
+
const parts = [];
|
|
164
|
+
for (const s of expr.d.strings) {
|
|
165
|
+
if (s.nodeType === PN.String)
|
|
166
|
+
parts.push(s.d.value);
|
|
167
|
+
else
|
|
168
|
+
return undefined; // an f-string component → not a static literal
|
|
169
|
+
}
|
|
170
|
+
return parts.join('');
|
|
171
|
+
}
|
|
172
|
+
if (expr.nodeType === PN.String)
|
|
173
|
+
return expr.d.value;
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
/** The value expression of a call's keyword argument `name=…`, or undefined. */
|
|
177
|
+
export function keywordArg(call, name) {
|
|
178
|
+
for (const arg of call.d.args) {
|
|
179
|
+
if (arg.d.name && arg.d.name.d.value === name)
|
|
180
|
+
return arg.d.valueExpr;
|
|
181
|
+
}
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
/** A call's positional argument value expressions, in order. */
|
|
185
|
+
export function positionalArgs(call) {
|
|
186
|
+
return call.d.args.filter((a) => !a.d.name).map((a) => a.d.valueExpr);
|
|
187
|
+
}
|
|
188
|
+
/** The first string literal in a list-literal expression (`["users", …]` →
|
|
189
|
+
* `'users'`), or undefined if it isn't a list or its first item isn't a string. */
|
|
190
|
+
export function firstListString(expr) {
|
|
191
|
+
if (!expr || expr.nodeType !== PN.List)
|
|
192
|
+
return undefined;
|
|
193
|
+
const items = expr.d.items;
|
|
194
|
+
return items.length > 0 ? stringValue(items[0]) : undefined;
|
|
195
|
+
}
|
|
196
|
+
// ---------------------------------------------------------------------------
|
|
197
|
+
// Class + type-annotation accessors (the ORM entity pass; generic
|
|
198
|
+
// Python-AST primitives, reusable by any class/annotation-driven adapter).
|
|
199
|
+
/** A class definition's name identifier, or undefined. */
|
|
200
|
+
export function className(cls) {
|
|
201
|
+
return nameValue(cls.d.name);
|
|
202
|
+
}
|
|
203
|
+
/** A class's POSITIONAL base-class expressions as `{ root, path }` chains
|
|
204
|
+
* (`class X(models.Model)` → `{ root:'models', path:['Model'] }`); keyword
|
|
205
|
+
* arguments (`table=True`, `metaclass=…`) are excluded. Non-dotted-name bases
|
|
206
|
+
* are dropped. */
|
|
207
|
+
export function classBaseChains(cls) {
|
|
208
|
+
const out = [];
|
|
209
|
+
for (const arg of cls.d.arguments) {
|
|
210
|
+
if (arg.d.name)
|
|
211
|
+
continue; // keyword arg, not a base
|
|
212
|
+
const chain = memberChain(arg.d.valueExpr);
|
|
213
|
+
if (chain)
|
|
214
|
+
out.push(chain);
|
|
215
|
+
}
|
|
216
|
+
return out;
|
|
217
|
+
}
|
|
218
|
+
/** The value expression of a class's keyword argument `name=…` (`table=True`),
|
|
219
|
+
* or undefined. */
|
|
220
|
+
export function classKeywordArg(cls, name) {
|
|
221
|
+
for (const arg of cls.d.arguments) {
|
|
222
|
+
if (arg.d.name && arg.d.name.d.value === name)
|
|
223
|
+
return arg.d.valueExpr;
|
|
224
|
+
}
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
227
|
+
/** Walk a class BODY (its suite) into the same collected-node shape — the
|
|
228
|
+
* per-class attribute assignments / field calls / `Mapped[…]` annotations an
|
|
229
|
+
* entity detector inspects. */
|
|
230
|
+
export function collectClassBody(cls) {
|
|
231
|
+
const collector = new NodeCollector();
|
|
232
|
+
collector.walk(cls.d.suite);
|
|
233
|
+
return collector.out;
|
|
234
|
+
}
|
|
235
|
+
/** The FunctionNodes declared DIRECTLY in a class body (its methods) — NOT nested
|
|
236
|
+
* functions inside those methods, and unlike `collectClassBody().functions` which
|
|
237
|
+
* recurses. Used by the GraphQL adapter to find field-resolver
|
|
238
|
+
* methods without descending into their bodies. */
|
|
239
|
+
export function classDirectFunctions(cls) {
|
|
240
|
+
const out = [];
|
|
241
|
+
const suite = cls.d.suite;
|
|
242
|
+
if (!suite || !suite.d)
|
|
243
|
+
return out;
|
|
244
|
+
for (const stmt of suite.d.statements) {
|
|
245
|
+
if (stmt.nodeType === PN.Function)
|
|
246
|
+
out.push(stmt);
|
|
247
|
+
}
|
|
248
|
+
return out;
|
|
249
|
+
}
|
|
250
|
+
/** The AssignmentNodes declared DIRECTLY in a class body (its class-level field
|
|
251
|
+
* assignments, e.g. graphene's `user = graphene.Field(User)`) — NOT assignments
|
|
252
|
+
* inside methods (which `collectClassBody().assignments` would include). Bare
|
|
253
|
+
* annotations (`user: User` with no `=`) are not assignments and are excluded. */
|
|
254
|
+
export function classDirectAssignments(cls) {
|
|
255
|
+
const out = [];
|
|
256
|
+
const suite = cls.d.suite;
|
|
257
|
+
if (!suite || !suite.d)
|
|
258
|
+
return out;
|
|
259
|
+
for (const stmt of suite.d.statements) {
|
|
260
|
+
// Simple statements sit inside a StatementList line; class-body fields are
|
|
261
|
+
// assignments within those lines.
|
|
262
|
+
if (stmt.nodeType !== PN.StatementList)
|
|
263
|
+
continue;
|
|
264
|
+
for (const s of stmt.d.statements) {
|
|
265
|
+
if (s.nodeType === PN.Assignment)
|
|
266
|
+
out.push(s);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return out;
|
|
270
|
+
}
|
|
271
|
+
/** The head of a (possibly subscripted) type expression as a `{ root, path }`
|
|
272
|
+
* chain: `Mapped[list["X"]]` → the `Mapped` chain; a plain `Foo`/`a.Foo` → its
|
|
273
|
+
* own chain. Undefined when the head isn't a dotted-name. */
|
|
274
|
+
export function annotationChain(expr) {
|
|
275
|
+
if (!expr)
|
|
276
|
+
return undefined;
|
|
277
|
+
if (expr.nodeType === PN.Index)
|
|
278
|
+
return memberChain(expr.d.leftExpr);
|
|
279
|
+
return memberChain(expr);
|
|
280
|
+
}
|
|
281
|
+
/** The subscript argument value expressions of an index expression
|
|
282
|
+
* (`Mapped[list["X"]]` → `[ list["X"] ]`), or `[]` when it isn't a subscript. */
|
|
283
|
+
export function subscriptArgs(expr) {
|
|
284
|
+
if (!expr || expr.nodeType !== PN.Index)
|
|
285
|
+
return [];
|
|
286
|
+
return expr.d.items.map((a) => a.d.valueExpr);
|
|
287
|
+
}
|
|
288
|
+
/** True iff `expr` is the boolean literal `True` (for `table=True`). */
|
|
289
|
+
export function isTrueConstant(expr) {
|
|
290
|
+
return (!!expr &&
|
|
291
|
+
expr.nodeType === PN.Constant &&
|
|
292
|
+
expr.d.constType === KW_TRUE);
|
|
293
|
+
}
|
|
294
|
+
// ---------------------------------------------------------------------------
|
|
295
|
+
// List + direct class-attribute accessors (Litestar's `route_handlers`
|
|
296
|
+
// list + a Controller's class-body `path`/`tags`; generic, reusable primitives).
|
|
297
|
+
/** A list-literal expression's item expressions (`[a, b.c, D()]` → the three
|
|
298
|
+
* item nodes), or `[]` if it isn't a list. */
|
|
299
|
+
export function listItems(expr) {
|
|
300
|
+
if (!expr || expr.nodeType !== PN.List)
|
|
301
|
+
return [];
|
|
302
|
+
return expr.d.items;
|
|
303
|
+
}
|
|
304
|
+
/** The RHS value expression of a DIRECT class-body assignment (`class C: path =
|
|
305
|
+
* "/x"` → the `"/x"` expr for name `'path'`), or undefined. Only the class's own
|
|
306
|
+
* top-level body is inspected (not nested classes/methods); the first match wins. */
|
|
307
|
+
export function classAttr(cls, name) {
|
|
308
|
+
for (const stmt of cls.d.suite.d.statements) {
|
|
309
|
+
// Simple statements are wrapped in a StatementList; handle a bare Assignment too.
|
|
310
|
+
const assigns = stmt.nodeType === PN.StatementList
|
|
311
|
+
? stmt.d.statements
|
|
312
|
+
: [stmt];
|
|
313
|
+
for (const inner of assigns) {
|
|
314
|
+
if (inner.nodeType !== PN.Assignment)
|
|
315
|
+
continue;
|
|
316
|
+
const a = inner;
|
|
317
|
+
if (nameValue(a.d.leftExpr) === name)
|
|
318
|
+
return a.d.rightExpr;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return undefined;
|
|
322
|
+
}
|
|
323
|
+
/** The value of a DIRECT class-body STRING assignment (`class C: path = "/x"` →
|
|
324
|
+
* `'/x'`), or undefined if absent / not a plain string literal. */
|
|
325
|
+
export function classAttrString(cls, name) {
|
|
326
|
+
return stringValue(classAttr(cls, name));
|
|
327
|
+
}
|
|
328
|
+
/** A dict literal's plain `key: value` entries, in source order (`{**spread}`
|
|
329
|
+
* expand entries are skipped). Empty for a non-dict expression. The key/value
|
|
330
|
+
* are raw expressions — resolve string keys/values with `stringValue`. Used by
|
|
331
|
+
* the Celery adapter to read a `beat_schedule = {…}` config statically. */
|
|
332
|
+
export function dictEntries(expr) {
|
|
333
|
+
if (!expr || expr.nodeType !== PN.Dictionary)
|
|
334
|
+
return [];
|
|
335
|
+
const out = [];
|
|
336
|
+
for (const item of expr.d.items) {
|
|
337
|
+
if (item.nodeType !== PN.DictionaryKeyEntry)
|
|
338
|
+
continue; // skip ** expand entries
|
|
339
|
+
const entry = item;
|
|
340
|
+
out.push({ keyExpr: entry.d.keyExpr, valueExpr: entry.d.valueExpr });
|
|
341
|
+
}
|
|
342
|
+
return out;
|
|
343
|
+
}
|
|
344
|
+
//# sourceMappingURL=py-ast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"py-ast.js","sourceRoot":"","sources":["../../../src/framework/python/py-ast.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,6EAA6E;AAC7E,gFAAgF;AAChF,wEAAwE;AACxE,iFAAiF;AACjF,wEAAwE;AACxE,6BAA6B;AAC7B,EAAE;AACF,mFAAmF;AACnF,0EAA0E;AAC1E,+EAA+E;AAC/E,kFAAkF;AAClF,+CAA+C;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