WillTools 2026-09-09 -- clean snapshot of the development repo for review
ci / test (push) Successful in 6m18s

History-free snapshot of the private development repository at cbe45c5
(2026-09-09). Code, docs and public catalogue only; no plant or job
knowledge layers, no client or job names (tools/scrub.py clean). The
intro deck is left out of this snapshot because its slide images could
not be checked for job drawings.
This commit is contained in:
2026-09-09 08:32:15 -05:00
commit 8e6ee31596
406 changed files with 223435 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
"""The small Python 2 / Python 3 bridge.
We do not choose the interpreter -- pyRevit does, from the engine configured
for the host. This extension was written on Revit 2025 with IronPython 2.7,
but the same folder may be dropped on a machine whose pyRevit is set to
IronPython 3 or CPython 3, where `unicode` and `basestring` are a NameError.
A NameError at module scope takes the whole button down with a traceback the
user cannot act on, so the two names are resolved once, here.
Everything else in this extension is already written in the intersection of
the two languages: no f-strings, no print statement, no implicit integer
division, no pathlib. Keep it that way and the engine stops mattering.
"""
try: # Python 2 (IronPython 2.7)
text_type = unicode # noqa: F821
string_types = (str, unicode) # noqa: F821
except NameError: # Python 3 (IronPython 3, CPython 3)
text_type = str
string_types = (str,)
def as_text(value, encoding='utf-8'):
"""Return value as the interpreter's unicode text type."""
if isinstance(value, text_type):
return value
if isinstance(value, bytes):
return value.decode(encoding)
return text_type(value)