# DjangoParser

**Kind:** Class

**Source:** [`atloria-monorepo/libs/parser-core/src/parsers/backend/django.parser.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/parser-core/src/parsers/backend/django.parser.ts#L67)

Django REST Framework Parser implementation

**Implements:** `IParser`

## Methods

| Method | Signature | Returns |
|---|---|---|
| `initialize` | `initialize(config: ParserConfig)` | `Promise<void>` |
| `canParse` | `canParse(filePath: string)` | `boolean` |
| `parseFile` | `parseFile(filePath: string, content: string)` | `Promise<ParseResult>` |
| `parseFiles` | `parseFiles(files: ParseFileInput[])` | `Promise<ParseResult[]>` |
| `destroy` | `destroy()` | `Promise<void>` |

## Properties

| Property | Type |
|---|---|
| `name` | `any` |
| `version` | `any` |
| `supportedPatterns` | `any` |

## Where it refuses work

- `DjangoParser` stops the work with an early return when `!fileContent.trim()`.
- `DjangoParser` stops the work with an early return when `!this.isDRFFile(fileContent)`.
- `DjangoParser` stops the work with an early return when `segments.length === 0`.
- `DjangoParser` stops the work with an early return when `!assignment`.
- `DjangoParser` stops the work with an early return when `close < 0`.
- `DjangoParser` stops the work with an early return when `depth === 0`.

## When something fails

- `DjangoParser` handles failure in 1 place: it turns it into a return value in all 1.
