django-orm-lens 1.2.6__tar.gz → 1.2.7__tar.gz
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.
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/PKG-INFO +1 -1
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens/parser.py +5 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens.egg-info/PKG-INFO +1 -1
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens.egg-info/SOURCES.txt +1 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/pyproject.toml +1 -1
- django_orm_lens-1.2.7/tests/test_bom_prefix.py +40 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/README.md +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens/__init__.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens/cli.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens/diff.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens/formatters.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens/mcp_server.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens/migrations_parser.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens/models.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens/py.typed +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens/query_analyzer.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens/signals_parser.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens.egg-info/dependency_links.txt +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens.egg-info/entry_points.txt +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens.egg-info/requires.txt +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens.egg-info/top_level.txt +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/setup.cfg +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_abstract_and_auth_user.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_aliased_module_and_third_party_fields.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_cli_hint.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_cli_subcommands_smoke.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_cli_verbose.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_cross_module_bases.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_diff_command.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_golden_fixtures.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_kwarg_order_and_auth_user.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_list_command.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_migration_risk.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_migrations_parser.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_nplusone_detector.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_parity.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_pep526_type_hints.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_pep695_generic_classes.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_query_analyzer.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_scan_root.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_signals_parser.py +0 -0
- {django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_tab_indented_models.py +0 -0
|
@@ -398,6 +398,11 @@ def _collect_defs(file_path: str, content: str) -> List[ParsedModel]:
|
|
|
398
398
|
result with definitions from other files before calling
|
|
399
399
|
``_resolve_and_filter``.
|
|
400
400
|
"""
|
|
401
|
+
# Strip leading BOM (U+FEFF) — Windows editors (Notepad, VS Code with
|
|
402
|
+
# certain settings) save UTF-8 files with a byte-order mark. Without this
|
|
403
|
+
# the first line becomes "class Foo..." and CLASS_RE fails to match.
|
|
404
|
+
if content.startswith(""):
|
|
405
|
+
content = content[1:]
|
|
401
406
|
# Expand tab characters to 4 spaces so the ``\s{indent}`` prefix used in
|
|
402
407
|
# FIELD_RE / BARE_FIELD_RE / META_ITEM_RE matches tab-indented code too.
|
|
403
408
|
# A single ``\t`` character otherwise contributes 1 to ``\s`` even though
|
|
@@ -19,6 +19,7 @@ django_orm_lens.egg-info/requires.txt
|
|
|
19
19
|
django_orm_lens.egg-info/top_level.txt
|
|
20
20
|
tests/test_abstract_and_auth_user.py
|
|
21
21
|
tests/test_aliased_module_and_third_party_fields.py
|
|
22
|
+
tests/test_bom_prefix.py
|
|
22
23
|
tests/test_cli_hint.py
|
|
23
24
|
tests/test_cli_subcommands_smoke.py
|
|
24
25
|
tests/test_cli_verbose.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "django-orm-lens"
|
|
7
|
-
version = "1.2.
|
|
7
|
+
version = "1.2.7"
|
|
8
8
|
description = "Static analysis + MCP server for Django models. Sidebar tree, ER diagrams, and JSON output for terminals and AI coding agents."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Regression: leading BOM (U+FEFF) must be stripped before parsing.
|
|
2
|
+
|
|
3
|
+
Windows editors - Notepad, older Sublime, VS Code with certain UTF-8
|
|
4
|
+
encoding settings - save files with a byte-order mark. Without this
|
|
5
|
+
fix the first line becomes "class Foo..." and CLASS_RE fails
|
|
6
|
+
to match. Result: zero models parsed for the whole file, silent.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import unittest
|
|
12
|
+
|
|
13
|
+
from django_orm_lens.parser import parse_models_file
|
|
14
|
+
|
|
15
|
+
BOM = ""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class BomPrefixTest(unittest.TestCase):
|
|
19
|
+
def test_bom_prefixed_file_parses(self) -> None:
|
|
20
|
+
src = (
|
|
21
|
+
BOM
|
|
22
|
+
+ "class Article(models.Model):\n"
|
|
23
|
+
" title = models.CharField(max_length=100)\n"
|
|
24
|
+
" body = models.TextField()\n"
|
|
25
|
+
)
|
|
26
|
+
models = parse_models_file("blog/models.py", src)
|
|
27
|
+
self.assertEqual(len(models), 1)
|
|
28
|
+
self.assertEqual(models[0].name, "Article")
|
|
29
|
+
self.assertEqual(
|
|
30
|
+
[f.name for f in models[0].fields], ["title", "body"]
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
def test_no_bom_still_works(self) -> None:
|
|
34
|
+
src = "class A(models.Model):\n x = models.CharField(max_length=5)\n"
|
|
35
|
+
models = parse_models_file("t/models.py", src)
|
|
36
|
+
self.assertEqual([f.name for f in models[0].fields], ["x"])
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
if __name__ == "__main__":
|
|
40
|
+
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/django_orm_lens.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_orm_lens-1.2.6 → django_orm_lens-1.2.7}/tests/test_aliased_module_and_third_party_fields.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|