name: dependency-injection
description: FastAPI pattern for app-scoped dependency injection via ResourceProvider[T] classes. Each provider owns one resource's construction and teardown as a single @asynccontextmanager, declares dependencies on other providers via constructor arguments, and is exposed as a fastapi.Depends callable; providers are composed into the app with compose_providers(*providers), which accepts None entries so conditional wiring inlines at the call site as provider if cond else None. "Resource" is load-bearing - this is only for things that live for the lifetime of the app. Per-request values (authenticated user, request-id, per-request DB transaction) use plain async def + Depends; ResourceProvider is not a universal DI container. Trigger whenever you add, refactor, or wire any app-scoped resource in a FastAPI project; HTTP clients, DB pools, service clients, Kafka producers/consumers, schedulers, caches, feature-flag clients, or any singleton that previously
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Parametric FastAPI dependencies: write a generic dependency once, specialize per model class. | |
| A dependency that binds the request body wants a *different Pydantic model per router* | |
| while sharing one implementation — but FastAPI fixes a ``Body()`` parameter's model at | |
| function-definition time. Hand-rolling a closure factory per dependency needs memoization | |
| (so specializations stay usable as ``dependency_overrides`` keys), default handling, and a | |
| runtime ``__annotations__`` patch: ~20 lines of machinery each time. | |
| ``parametric`` packages that machinery as a decorator. Declare the dependency once as a | |
| PEP 695 generic function whose single type parameter carries a class bound:: |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| IQ== 5 | |
| Ig== 6 | |
| Iw== 7 | |
| JA== 8 | |
| JQ== 9 | |
| Jg== 10 | |
| Jw== 11 | |
| KA== 12 | |
| KQ== 13 |
This is a supply-chain cryptocurrency stealing payload — a "clipper" or "address swapper" that silently redirects crypto transactions to attacker-controlled wallets.
The payload has four layers:
1. String Obfuscation Engine
The bulk of the code is a multi-layered string decoding system (oFmFNH, iVp0dU7, byZJpo, fLOUxWf, etc.) using base91-like encoding with shuffled alphabets. Every meaningful string is encoded to evade static analysis.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var __defProp = Object.defineProperty; | |
| var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | |
| // node_modules/unenv/dist/runtime/_internal/utils.mjs | |
| // @__NO_SIDE_EFFECTS__ | |
| function createNotImplementedError(name) { | |
| return new Error(`[unenv] ${name} is not implemented yet!`); | |
| } | |
| __name(createNotImplementedError, "createNotImplementedError"); | |
| // @__NO_SIDE_EFFECTS__ |
Maybe you can flat using dot-free style function calls too.
However, it unnecessarly add runtime overhead, pollute the callstack, and even not intuitive as direct-style control flows are.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Generated by ReScript, PLEASE EDIT WITH CARE | |
| import * as Objects from "./Objects.res.mjs"; | |
| import * as Caml_obj from "rescript/lib/es6/caml_obj.js"; | |
| import * as Caml_int32 from "rescript/lib/es6/caml_int32.js"; | |
| import * as Environment from "./Environment.res.mjs"; | |
| var cTRUE = { | |
| TAG: "MBoolean", | |
| _0: { |
# Cargo binstall
# https://github.com/cargo-bins/cargo-binstall?tab=readme-ov-file#telemetry-collection
export BINSTALL_DISABLE_TELEMETRY=true
# Go Telemetry (not opt-in by default)
# https://go.dev/doc/telemetry
export GOTELEMETRY=off
# GatsbyJS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function encode(value) { | |
| const long = BigInt(value); | |
| const result = []; | |
| let shift = 0n; | |
| while (true) { | |
| const number = Number(BigInt.asUintN(7, long >> shift)); | |
| if (number) { | |
| result.push(number); | |
| shift += 7n; |
NewerOlder