fix: normalize d5p1 namespace in info scripts and fix Python IndentationErrors

- meta-info, form-info (PS+PY): recognize dNpN: prefix alongside cfg: in type parsing
- Fix module-level sys.stderr.reconfigure indentation in 9 Python scripts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-03-05 12:08:07 +03:00
parent fde6d346d7
commit 872675652f
11 changed files with 19 additions and 13 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ from collections import OrderedDict
from lxml import etree
sys.stdout.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
# --- Argument parsing ---
parser = argparse.ArgumentParser(description="Analyze 1C configuration structure", allow_abbrev=False)
@@ -9,7 +9,7 @@ import sys
from lxml import etree
sys.stdout.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
# ── arg parsing ──────────────────────────────────────────────
@@ -58,8 +58,8 @@ function Format-Type($typeNode) {
$typeSet = $typeNode.SelectSingleNode("v8:TypeSet", $ns)
if ($typeSet) {
$val = $typeSet.InnerText
# Strip cfg: prefix for DefinedType, keep as-is
if ($val -like "cfg:*") { $val = $val.Substring(4) }
# Strip cfg:/d5p1: prefix for DefinedType, keep as-is
$val = $val -replace '^(cfg|d\d+p\d+):', ''
return $val
}
@@ -101,7 +101,7 @@ function Format-Type($typeNode) {
}
}
"xs:binary" { $parts += "binary" }
"cfg:*" { $parts += $raw.Substring(4) }
{ $_ -like "cfg:*" -or $_ -match '^d\d+p\d+:' } { $parts += ($raw -replace '^(cfg|d\d+p\d+):', '') }
"v8:ValueTable" { $parts += "ValueTable" }
"v8:ValueTree" { $parts += "ValueTree" }
"v8:ValueListType" { $parts += "ValueList" }
@@ -102,8 +102,8 @@ def format_type(type_node):
parts.append("dateTime")
elif raw == "xs:binary":
parts.append("binary")
elif raw.startswith("cfg:"):
parts.append(raw[4:])
elif raw.startswith("cfg:") or re.match(r'^d\d+p\d+:', raw):
parts.append(re.sub(r'^(?:cfg|d\d+p\d+):', '', raw))
elif raw == "v8:ValueTable":
parts.append("ValueTable")
elif raw == "v8:ValueTree":
@@ -223,6 +223,8 @@ function Format-SingleType([string]$raw, $parentNode) {
"v8:UUID" { return "УникальныйИдентификатор" }
"v8:Null" { return "Null" }
default {
# Normalize d5p1:/dNpN: -> cfg:
$raw = $raw -replace '^d\d+p\d+:', 'cfg:'
# cfg:CatalogRef.Xxx -> СправочникСсылка.Xxx
if ($raw -match '^cfg:(\w+)Ref\.(.+)$') {
$prefix = "$($Matches[1])Ref"
@@ -356,6 +358,7 @@ function Decline-Cols([int]$n) {
}
function Format-SourceType([string]$raw) {
$raw = $raw -replace '^d\d+p\d+:', 'cfg:'
if ($raw -match '^cfg:(\w+)\.(.+)$') {
$prefix = $Matches[1]; $name = $Matches[2]
if ($objectTypeMap.ContainsKey($prefix)) { return "$($objectTypeMap[$prefix]).$name" }
@@ -8,7 +8,7 @@ import sys
from lxml import etree
sys.stdout.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
# ── arg parsing ──────────────────────────────────────────────
@@ -282,6 +282,8 @@ def format_single_type(raw, parent_node):
return "УникальныйИдентификатор"
if raw == "v8:Null":
return "Null"
# Normalize d5p1:/dNpN: → cfg: (both map to same namespace)
raw = re.sub(r'^d\d+p\d+:', 'cfg:', raw)
# cfg:CatalogRef.Xxx -> СправочникСсылка.Xxx
m = re.match(r'^cfg:(\w+)Ref\.(.+)$', raw)
if m:
@@ -410,6 +412,7 @@ def decline_cols(n):
def format_source_type(raw):
raw = re.sub(r'^d\d+p\d+:', 'cfg:', raw)
m = re.match(r'^cfg:(\w+)\.(.+)$', raw)
if m:
prefix = m.group(1)
+1 -1
View File
@@ -10,7 +10,7 @@ import sys
from lxml import etree
sys.stdout.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
# --- Argument parsing ---
parser = argparse.ArgumentParser(description="Analyze 1C spreadsheet (MXL) structure", allow_abbrev=False)
@@ -9,7 +9,7 @@ from collections import OrderedDict
from lxml import etree
sys.stdout.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
# --- Argument parsing ---
parser = argparse.ArgumentParser(description="Analyze 1C role rights", allow_abbrev=False)
+1 -1
View File
@@ -9,7 +9,7 @@ import uuid
from lxml import etree
sys.stdout.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
# ── arg parsing ──────────────────────────────────────────────
@@ -7,7 +7,7 @@ import sys
from lxml import etree
sys.stdout.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
# ── arg parsing ──────────────────────────────────────────────
@@ -10,7 +10,7 @@ from collections import OrderedDict
from lxml import etree
sys.stdout.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
# --- Argument parsing ---
parser = argparse.ArgumentParser(description="Analyze 1C subsystem structure", allow_abbrev=False)