mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-24 21:51:02 +03:00
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:
co-authored by
Claude Opus 4.6
parent
fde6d346d7
commit
872675652f
@@ -9,7 +9,7 @@ from collections import OrderedDict
|
|||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
sys.stdout.reconfigure(encoding="utf-8")
|
sys.stdout.reconfigure(encoding="utf-8")
|
||||||
sys.stderr.reconfigure(encoding="utf-8")
|
sys.stderr.reconfigure(encoding="utf-8")
|
||||||
|
|
||||||
# --- Argument parsing ---
|
# --- Argument parsing ---
|
||||||
parser = argparse.ArgumentParser(description="Analyze 1C configuration structure", allow_abbrev=False)
|
parser = argparse.ArgumentParser(description="Analyze 1C configuration structure", allow_abbrev=False)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import sys
|
|||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
sys.stdout.reconfigure(encoding="utf-8")
|
sys.stdout.reconfigure(encoding="utf-8")
|
||||||
sys.stderr.reconfigure(encoding="utf-8")
|
sys.stderr.reconfigure(encoding="utf-8")
|
||||||
|
|
||||||
# ── arg parsing ──────────────────────────────────────────────
|
# ── arg parsing ──────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ function Format-Type($typeNode) {
|
|||||||
$typeSet = $typeNode.SelectSingleNode("v8:TypeSet", $ns)
|
$typeSet = $typeNode.SelectSingleNode("v8:TypeSet", $ns)
|
||||||
if ($typeSet) {
|
if ($typeSet) {
|
||||||
$val = $typeSet.InnerText
|
$val = $typeSet.InnerText
|
||||||
# Strip cfg: prefix for DefinedType, keep as-is
|
# Strip cfg:/d5p1: prefix for DefinedType, keep as-is
|
||||||
if ($val -like "cfg:*") { $val = $val.Substring(4) }
|
$val = $val -replace '^(cfg|d\d+p\d+):', ''
|
||||||
return $val
|
return $val
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ function Format-Type($typeNode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
"xs:binary" { $parts += "binary" }
|
"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:ValueTable" { $parts += "ValueTable" }
|
||||||
"v8:ValueTree" { $parts += "ValueTree" }
|
"v8:ValueTree" { $parts += "ValueTree" }
|
||||||
"v8:ValueListType" { $parts += "ValueList" }
|
"v8:ValueListType" { $parts += "ValueList" }
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ def format_type(type_node):
|
|||||||
parts.append("dateTime")
|
parts.append("dateTime")
|
||||||
elif raw == "xs:binary":
|
elif raw == "xs:binary":
|
||||||
parts.append("binary")
|
parts.append("binary")
|
||||||
elif raw.startswith("cfg:"):
|
elif raw.startswith("cfg:") or re.match(r'^d\d+p\d+:', raw):
|
||||||
parts.append(raw[4:])
|
parts.append(re.sub(r'^(?:cfg|d\d+p\d+):', '', raw))
|
||||||
elif raw == "v8:ValueTable":
|
elif raw == "v8:ValueTable":
|
||||||
parts.append("ValueTable")
|
parts.append("ValueTable")
|
||||||
elif raw == "v8:ValueTree":
|
elif raw == "v8:ValueTree":
|
||||||
|
|||||||
@@ -223,6 +223,8 @@ function Format-SingleType([string]$raw, $parentNode) {
|
|||||||
"v8:UUID" { return "УникальныйИдентификатор" }
|
"v8:UUID" { return "УникальныйИдентификатор" }
|
||||||
"v8:Null" { return "Null" }
|
"v8:Null" { return "Null" }
|
||||||
default {
|
default {
|
||||||
|
# Normalize d5p1:/dNpN: -> cfg:
|
||||||
|
$raw = $raw -replace '^d\d+p\d+:', 'cfg:'
|
||||||
# cfg:CatalogRef.Xxx -> СправочникСсылка.Xxx
|
# cfg:CatalogRef.Xxx -> СправочникСсылка.Xxx
|
||||||
if ($raw -match '^cfg:(\w+)Ref\.(.+)$') {
|
if ($raw -match '^cfg:(\w+)Ref\.(.+)$') {
|
||||||
$prefix = "$($Matches[1])Ref"
|
$prefix = "$($Matches[1])Ref"
|
||||||
@@ -356,6 +358,7 @@ function Decline-Cols([int]$n) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Format-SourceType([string]$raw) {
|
function Format-SourceType([string]$raw) {
|
||||||
|
$raw = $raw -replace '^d\d+p\d+:', 'cfg:'
|
||||||
if ($raw -match '^cfg:(\w+)\.(.+)$') {
|
if ($raw -match '^cfg:(\w+)\.(.+)$') {
|
||||||
$prefix = $Matches[1]; $name = $Matches[2]
|
$prefix = $Matches[1]; $name = $Matches[2]
|
||||||
if ($objectTypeMap.ContainsKey($prefix)) { return "$($objectTypeMap[$prefix]).$name" }
|
if ($objectTypeMap.ContainsKey($prefix)) { return "$($objectTypeMap[$prefix]).$name" }
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import sys
|
|||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
sys.stdout.reconfigure(encoding="utf-8")
|
sys.stdout.reconfigure(encoding="utf-8")
|
||||||
sys.stderr.reconfigure(encoding="utf-8")
|
sys.stderr.reconfigure(encoding="utf-8")
|
||||||
|
|
||||||
# ── arg parsing ──────────────────────────────────────────────
|
# ── arg parsing ──────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -282,6 +282,8 @@ def format_single_type(raw, parent_node):
|
|||||||
return "УникальныйИдентификатор"
|
return "УникальныйИдентификатор"
|
||||||
if raw == "v8:Null":
|
if raw == "v8:Null":
|
||||||
return "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
|
# cfg:CatalogRef.Xxx -> СправочникСсылка.Xxx
|
||||||
m = re.match(r'^cfg:(\w+)Ref\.(.+)$', raw)
|
m = re.match(r'^cfg:(\w+)Ref\.(.+)$', raw)
|
||||||
if m:
|
if m:
|
||||||
@@ -410,6 +412,7 @@ def decline_cols(n):
|
|||||||
|
|
||||||
|
|
||||||
def format_source_type(raw):
|
def format_source_type(raw):
|
||||||
|
raw = re.sub(r'^d\d+p\d+:', 'cfg:', raw)
|
||||||
m = re.match(r'^cfg:(\w+)\.(.+)$', raw)
|
m = re.match(r'^cfg:(\w+)\.(.+)$', raw)
|
||||||
if m:
|
if m:
|
||||||
prefix = m.group(1)
|
prefix = m.group(1)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import sys
|
|||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
sys.stdout.reconfigure(encoding="utf-8")
|
sys.stdout.reconfigure(encoding="utf-8")
|
||||||
sys.stderr.reconfigure(encoding="utf-8")
|
sys.stderr.reconfigure(encoding="utf-8")
|
||||||
|
|
||||||
# --- Argument parsing ---
|
# --- Argument parsing ---
|
||||||
parser = argparse.ArgumentParser(description="Analyze 1C spreadsheet (MXL) structure", allow_abbrev=False)
|
parser = argparse.ArgumentParser(description="Analyze 1C spreadsheet (MXL) structure", allow_abbrev=False)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from collections import OrderedDict
|
|||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
sys.stdout.reconfigure(encoding="utf-8")
|
sys.stdout.reconfigure(encoding="utf-8")
|
||||||
sys.stderr.reconfigure(encoding="utf-8")
|
sys.stderr.reconfigure(encoding="utf-8")
|
||||||
|
|
||||||
# --- Argument parsing ---
|
# --- Argument parsing ---
|
||||||
parser = argparse.ArgumentParser(description="Analyze 1C role rights", allow_abbrev=False)
|
parser = argparse.ArgumentParser(description="Analyze 1C role rights", allow_abbrev=False)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import uuid
|
|||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
sys.stdout.reconfigure(encoding="utf-8")
|
sys.stdout.reconfigure(encoding="utf-8")
|
||||||
sys.stderr.reconfigure(encoding="utf-8")
|
sys.stderr.reconfigure(encoding="utf-8")
|
||||||
|
|
||||||
# ── arg parsing ──────────────────────────────────────────────
|
# ── arg parsing ──────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import sys
|
|||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
sys.stdout.reconfigure(encoding="utf-8")
|
sys.stdout.reconfigure(encoding="utf-8")
|
||||||
sys.stderr.reconfigure(encoding="utf-8")
|
sys.stderr.reconfigure(encoding="utf-8")
|
||||||
|
|
||||||
# ── arg parsing ──────────────────────────────────────────────
|
# ── arg parsing ──────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from collections import OrderedDict
|
|||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
sys.stdout.reconfigure(encoding="utf-8")
|
sys.stdout.reconfigure(encoding="utf-8")
|
||||||
sys.stderr.reconfigure(encoding="utf-8")
|
sys.stderr.reconfigure(encoding="utf-8")
|
||||||
|
|
||||||
# --- Argument parsing ---
|
# --- Argument parsing ---
|
||||||
parser = argparse.ArgumentParser(description="Analyze 1C subsystem structure", allow_abbrev=False)
|
parser = argparse.ArgumentParser(description="Analyze 1C subsystem structure", allow_abbrev=False)
|
||||||
|
|||||||
Reference in New Issue
Block a user