Commit 3b5ba4d4 authored by Michael Büsch's avatar Michael Büsch

common: Add __all__

Signed-off-by: Michael Büsch's avatarMichael Buesch <m@bues.ch>
parent 32db84fb
......@@ -25,6 +25,7 @@ from awlsim.common.compat import *
import sys
import re
from awlsim.common.enumeration import *
from awlsim.common.project import *
from awlsim.common.refmanager import *
from awlsim.common.namevalidation import *
......
......@@ -23,6 +23,11 @@ from __future__ import division, absolute_import, print_function, unicode_litera
from awlsim.common.compat import *
__all__ = [
"Blocker",
]
class Blocker(object):
"""'with'-statement based single threaded blocker.
This is _not_ a multi-thread lock."""
......
......@@ -22,6 +22,7 @@
from __future__ import division, absolute_import, print_function, unicode_literals
from awlsim.common.compat import *
from awlsim.common.enumeration import *
from awlsim.common.util import *
......
......@@ -29,6 +29,11 @@ from awlsim.coreclient.client import *
import threading
__all__ = [
"AwlValidator",
]
class AwlValidator(object):
"""Source code validation.
"""
......
......@@ -30,6 +30,39 @@ import math
import contextlib
__all__ = [
"osIsWindows",
"osIsPosix",
"standaloneServerExe",
"isPyPy",
"isJython",
"isIronPython",
"isCython",
"isMicroPython",
"isWinStandalone",
"isPy3Compat",
"isPy2Compat",
"py23",
"pythonInterpreter",
"input",
"range",
"reduce",
"queue",
"monotonic_time",
"perf_monotonic_time",
"BlockingIOError",
"ConnectionError",
"StringIO",
"isalnum",
"isdecimal",
"compat_gcd",
"contextlib",
"dictItems",
"dictKeys",
"dictValues",
]
# Convenient operating system identifiers
if os.name == "java":
import java.lang.System
......@@ -103,16 +136,22 @@ else:
# Force Python3 behavior
if isPy2Compat:
input = raw_input
else:
input = input
# range() compatibility.
# Force Python3 behavior
if isPy2Compat:
range = xrange
else:
range = range
# reduce() compatibility.
# Force Python2 behavior
if isPy3Compat:
from functools import reduce
else:
reduce = reduce
# queue compatibility
# Force Python3 behavior
......@@ -131,12 +170,14 @@ try:
BlockingIOError
except NameError:
class BlockingIOError(BaseException): pass
BlockingIOError = BlockingIOError
# ConnectionError dummy
try:
ConnectionError
except NameError:
ConnectionError = OSError
ConnectionError = ConnectionError
# Import StringIO
if isIronPython and isPy2Compat:
......@@ -144,6 +185,7 @@ if isIronPython and isPy2Compat:
from StringIO import StringIO
else:
from io import StringIO
StringIO = StringIO
from io import BytesIO
# str.isalnum() compatibility
......
......@@ -26,6 +26,12 @@ import gc as garbageCollector
#garbageCollector.set_debug(garbageCollector.DEBUG_LEAK)
__all__ = [
"AwlDebug",
]
class AwlDebug(object):
@classmethod
def getMemoryLeaks(cls):
......
......@@ -23,6 +23,11 @@ from __future__ import division, absolute_import, print_function, unicode_litera
from awlsim.common.compat import *
__all__ = [
"importModule",
]
def importModule(moduleName):
"""Import a module with the name string 'moduleName'.
Returns the module object.
......
......@@ -23,6 +23,11 @@ from __future__ import division, absolute_import, print_function, unicode_litera
from awlsim.common.compat import *
__all__ = [
"EnumGen",
]
class MagicEnumerationGenerator(object):
"Magic enumeration generator"
......
......@@ -25,6 +25,17 @@ from awlsim.common.compat import *
from awlsim.common.enumeration import *
__all__ = [
"AwlSimError",
"AwlParserError",
"AwlSimBug",
"FrozenAwlSimError",
"MaintenanceRequest",
"ExitCodes",
"suppressAllExc",
]
class AwlSimError(Exception):
"""Main AwlSim exception.
"""
......
......@@ -29,6 +29,12 @@ import hashlib
import binascii
__all__ = [
"HwmodDescriptorFactory",
"HwmodDescriptor",
]
class HwmodDescriptorFactory(XmlFactory):
def parser_open(self, tag=None):
hwmodDesc = self.hwmodDesc
......
......@@ -23,6 +23,11 @@ from __future__ import division, absolute_import, print_function, unicode_litera
from awlsim.common.compat import *
__all__ = [
"OptionalImmutable",
]
__useDummy = False
if isMicroPython:
__useDummy = True
......
......@@ -25,6 +25,11 @@ from awlsim.common.compat import *
import re
__all__ = [
"AwlName",
]
class AwlName(object):
labelRe = re.compile(r'^[_a-zA-Z][_0-9a-zA-Z]{0,3}$')
alpha_lower = "abcdefghijklmnopqrstuvwxyz"
......
......@@ -26,6 +26,14 @@ from awlsim.common.util import *
import socket
__all__ = [
"AF_UNIX",
"SocketErrors",
"netGetAddrInfo",
"netPortIsUnused",
]
if hasattr(socket, "AF_UNIX"):
AF_UNIX = socket.AF_UNIX
else:
......
......@@ -23,6 +23,12 @@ from __future__ import division, absolute_import, print_function, unicode_litera
from awlsim.common.compat import *
__all__ = [
"ObjRef",
"ObjRefManager",
]
class ObjRef(object):
"""An object reference."""
......
......@@ -30,6 +30,16 @@ import base64, binascii
import hashlib
__all__ = [
"AwlSource",
"FupSource",
"KopSource",
"SymTabSource",
"SourceManager",
"SourceContainer",
]
class SourceFactory(XmlFactory):
def parser_open(self, tag=None):
project, source = self.project, self.source
......
......@@ -24,6 +24,13 @@ from awlsim.common.compat import *
import distutils.spawn
__all__ = [
"findExecutable",
"PopenWrapper",
]
if isIronPython:
import os
import signal
......
......@@ -23,6 +23,11 @@ from __future__ import division, absolute_import, print_function, unicode_litera
from awlsim.common.compat import *
__all__ = [
"Templates",
]
class Templates(object):
# OB template
__templateOB = """ORGANIZATION_BLOCK OB @@NR@@
......
......@@ -35,6 +35,44 @@ import functools
import itertools
__all__ = [
"functools",
"itertools",
"Logging",
"printDebug",
"printVerbose",
"printInfo",
"printWarning",
"printError",
"fileExists",
"safeFileRead",
"safeFileWrite",
"strPartitionFull",
"str2bool",
"strToBase64",
"base64ToStr",
"bytesToHexStr",
"toUnixEol",
"toDosEol",
"envClearLang",
"isInteger",
"isString",
"isiterable",
"getfirst",
"getany",
"toList",
"toSet",
"pivotDict",
"listIndex",
"listToHumanStr",
"listExpand",
"math_gcd",
"math_lcm",
"nopContext",
"RelPath",
]
class Logging(object):
EnumGen.start
LOG_NONE = EnumGen.item
......
......@@ -2,6 +2,13 @@ from __future__ import division, absolute_import, print_function, unicode_litera
from awlsim.common.compat import *
__all__ = [
"VERSION_MAJOR",
"VERSION_MINOR",
"VERSION_STRING",
]
VERSION_MAJOR = 0
VERSION_MINOR = 54
......
......@@ -27,6 +27,11 @@ from awlsim.common.exceptions import *
import struct
__all__ = [
"WordPacker",
]
class _WordPacker:
"""Pack/unpack bytes/words/dwords into/from a byte stream."""
......
......@@ -22,6 +22,7 @@
from __future__ import division, absolute_import, print_function, unicode_literals
from awlsim.common.compat import *
from awlsim.common.enumeration import *
from awlsim.common.util import *
import xml.etree.ElementTree
......
......@@ -23,6 +23,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
from awlsim.common.compat import *
from awlsim.common.util import *
from awlsim.common.enumeration import *
from awlsim.core.memory import * #+cimport
from awlsim.core.datatypes import *
......
......@@ -24,6 +24,7 @@ from awlsim.common.compat import *
from awlsim.common.datatypehelpers import * #+cimport
from awlsim.common.immutable import *
from awlsim.common.enumeration import *
from awlsim.core.util import *
from awlsim.core.timers import *
......
......@@ -22,8 +22,9 @@
from __future__ import division, absolute_import, print_function, unicode_literals
from awlsim.common.compat import *
from awlsim.common.exceptions import *
from awlsim.core.offset import * #+cimport
from awlsim.core.util import AwlSimError
from awlsim.core.hardware_loader import *
from awlsim.core.hardware_params import *
#from awlsim.core.hardware cimport * #@cy
......
......@@ -22,6 +22,7 @@
from __future__ import division, absolute_import, print_function, unicode_literals
from awlsim.common.compat import *
from awlsim.common.exceptions import *
from awlsim.common.cpuconfig import *
from awlsim.core.datatypes import *
......
......@@ -23,3 +23,4 @@ from __future__ import division, absolute_import, print_function, unicode_litera
from awlsim.common.compat import *
from awlsim.common.util import *
from awlsim.common.exceptions import *
......@@ -22,6 +22,7 @@
from __future__ import division, absolute_import, print_function, unicode_literals
from awlsim.common.compat import *
from awlsim.common.enumeration import *
from awlsim.common.util import *
import struct
......
......@@ -23,6 +23,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
from awlsim.common.compat import *
from awlsim.common.util import *
from awlsim.common.enumeration import *
from awlsim.common.exceptions import *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment