Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
54f77bd
remove double import
mandolaerik May 26, 2026
964d6c4
remove redundant f-string
mandolaerik May 26, 2026
dbbb98e
repair function name
mandolaerik May 26, 2026
5e3e60e
Dodge harmless name clashes
mandolaerik May 26, 2026
2e00279
Remove redundant imports
mandolaerik May 26, 2026
2adfff9
Silence false positive for F401
mandolaerik May 26, 2026
c3d5873
Avoid most star imports
mandolaerik May 26, 2026
920151b
Silence warnings for star imports caused by plyisms
mandolaerik May 27, 2026
db47b3e
Qualify type imports using `tp` prefix
mandolaerik May 27, 2026
2972f0b
Rename TInt -> Int etc
mandolaerik May 27, 2026
a22ed0e
Qualify ctree imports as c
mandolaerik May 27, 2026
11b4e2c
remove unused functions
mandolaerik May 27, 2026
6e46267
Avoid star imports for DMLError
mandolaerik May 27, 2026
56b3790
Avoid star imports for DMLWarning
mandolaerik May 27, 2026
91c0193
Avoid star imports for PortingMessage
mandolaerik May 27, 2026
36cc6c5
Remove messages.py
mandolaerik May 27, 2026
0a31b4f
Remove unused imports
mandolaerik May 27, 2026
3569f25
remove redundant implementation
mandolaerik May 27, 2026
3b076fd
remove broken `__all__` members
mandolaerik May 27, 2026
2f07bb1
change nonexistent error to ICE
mandolaerik May 27, 2026
1b3174f
Import `simics` explicitly
mandolaerik May 27, 2026
1552180
Add missing imports
mandolaerik May 27, 2026
c28d572
repair dead code
mandolaerik May 27, 2026
47eb2f8
Avoid communicating info through globals
mandolaerik May 27, 2026
68926d5
Communicate scratchdir through new module testenv
mandolaerik May 27, 2026
e5b2fc9
Make test dev instantiation explicit
mandolaerik May 27, 2026
c629032
Import conf explicitly
mandolaerik May 27, 2026
a745b26
Prune dead branches
mandolaerik May 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion MODULEINFO
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Make: dmlc
$(HOST)/bin/dml/python/dml/dmllex14.py
$(HOST)/bin/dml/python/dml/dmlparse.py
$(HOST)/bin/dml/python/dml/dmlc.py
$(HOST)/bin/dml/python/dml/errors.py
$(HOST)/bin/dml/python/dml/expr.py
$(HOST)/bin/dml/python/dml/expr_util.py
$(HOST)/bin/dml/python/dml/globals.py
Expand All @@ -50,9 +51,9 @@ Make: dmlc
$(HOST)/bin/dml/python/dml/int_register.py
$(HOST)/bin/dml/python/dml/io_memory.py
$(HOST)/bin/dml/python/dml/logging.py
$(HOST)/bin/dml/python/dml/messages.py
$(HOST)/bin/dml/python/dml/objects.py
$(HOST)/bin/dml/python/dml/output.py
$(HOST)/bin/dml/python/dml/porting.py
$(HOST)/bin/dml/python/dml/provisional.py
$(HOST)/bin/dml/python/dml/reginfo.py
$(HOST)/bin/dml/python/dml/serialize.py
Expand All @@ -65,6 +66,7 @@ Make: dmlc
$(HOST)/bin/dml/python/dml/topsort.py
$(HOST)/bin/dml/python/dml/traits.py
$(HOST)/bin/dml/python/dml/types.py
$(HOST)/bin/dml/python/dml/warnings.py
$(HOST)/bin/dml/python/dml/dml12_parsetab.py
$(HOST)/bin/dml/python/dml/dml14_parsetab.py
$(HOST)/bin/dml/python/LICENSE
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,25 @@ PYFILES := dml/__init__.py \
dml/dmllex14.py \
dml/dmlparse.py \
dml/dmlc.py \
dml/errors.py \
dml/expr.py \
dml/expr_util.py \
dml/globals.py \
dml/info_backend.py \
dml/io_memory.py \
dml/int_register.py \
dml/logging.py \
dml/messages.py \
dml/objects.py \
dml/output.py \
dml/porting.py \
dml/provisional.py \
dml/reginfo.py \
dml/serialize.py \
dml/set.py \
dml/slotsmeta.py \
dml/structure.py \
dml/symtab.py \
dml/warnings.py \
__main__.py

PYUNIT_FILES := $(wildcard $(DMLC_DIR)/py/dml/*_test.py)
Expand Down
32 changes: 10 additions & 22 deletions messages_to_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,15 @@ def fmt_message(err):

def extract_messages(sys_path):
sys.path.append(sys_path)
from dml import messages
from dml.messages import DMLError, DMLWarning
from dml import warnings, errors

errors = []
warnings = []

for n in dir(messages):
o = getattr(messages, n)
#sys.stderr.write("%s: %r\n" % (n, o))
if isinstance(o, type):
if issubclass(o, DMLError) and o is not DMLError:
errors.append(o)
elif issubclass(o, DMLWarning) and o is not DMLWarning:
warnings.append(o)

errors.sort(key=lambda x: x.fmt)
warnings.sort(key=lambda x: x.fmt)
return (warnings, errors)
return (warnings.all_warnings, errors.all_errors)

def print_message_table(f, messages):
f.write("<dl>\n")
for m in messages:
assert m.__doc__
f.write(f" <dt><b>\n\n{fmt_message(m)} [{m.__name__}]</b></dt>\n")
for (tag, m) in sorted(messages.items()):
assert m.__doc__, m
f.write(f" <dt><b>\n\n{fmt_message(m)} [{tag}]</b></dt>\n")
doc = '\n'.join(line[4:] if line.startswith(' ') else line
for line in m.__doc__.strip().splitlines())
f.write(f" <dd>\n\n{doc}\n</dd>\n")
Expand Down Expand Up @@ -94,5 +79,8 @@ def matches_version(message, target):
(warnings, errors) = extract_messages(args.path)
with open(args.outfile, 'w') as f:
print_messages(
f, [w for w in warnings if matches_version(w, args.version)],
[e for e in errors if matches_version(e, args.version)])
f,
{tag: w for (tag, w) in warnings.items()
if matches_version(w, args.version)},
{tag: e for (tag, e) in errors.items()
if matches_version(e, args.version)})
17 changes: 3 additions & 14 deletions porting_to_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,15 @@
[path_to_dml, outfile] = sys.argv[1:]
sys.path.append(path_to_dml)

from dml import messages
from dml.messages import PortingMessage

portings = []

for n in dir(messages):
o = getattr(messages, n)
if (isinstance(o, type) and issubclass(o, PortingMessage)
and o is not PortingMessage):
portings.append(o)

portings.sort(key=lambda x: x.__name__)
from dml.porting import all_portings

with open(outfile, 'w') as f:
f.write("# Language differences handled by the port-dml script\n\n")

f.write("<dl>\n")
for m in portings:
for (tag, m) in sorted(all_portings.items()):
assert m.__doc__
f.write(f" <dt>{m.__name__}</dt>\n")
f.write(f" <dt>{tag}</dt>\n")
doc = '\n'.join(line[4:] if line.startswith(' ') else line
for line in m.__doc__.strip().splitlines())
f.write(f" <dd>\n\n{doc}\n</dd>\n")
Expand Down
1 change: 0 additions & 1 deletion provisional_to_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
dml12_only = {'1.2': True, '1.4': False}[dml_version]

from dml import provisional
from dml.env import api_versions, default_api_version

with open(outfile, 'w') as f:
f.write(Path(header).read_text())
Expand Down
4 changes: 2 additions & 2 deletions py/dead_dml_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ def traverse_ast(ast):

def method_locations(path):
from dml.toplevel import parse_file, determine_version
from dml import logging, messages
from dml import logging, warnings
from dml import breaking_changes
# needed to parse 1.2/utility.dml
breaking_changes.BreakingChange.enabled_breaking_changes = (
set(breaking_changes.changes.values())
- {breaking_changes.forbid_warning_statement})
for warning in messages.warnings:
for warning in warnings.all_warnings:
logging.ignore_warning(warning)

(version, _) = determine_version(path.read_text(), path)
Expand Down
1 change: 0 additions & 1 deletion py/dml/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# SPDX-License-Identifier: MPL-2.0

import builtins
from .logging import dbg

class AST(object):
__slots__ = ('__site', '__args', 'kind')
Expand Down
Loading