return op_result
return not op_result
-_convert = {
+_convert = frozendict({
'__lt__': [('__gt__', _gt_from_lt),
('__le__', _le_from_lt),
('__ge__', _ge_from_lt)],
'__ge__': [('__le__', _le_from_ge),
('__gt__', _gt_from_ge),
('__lt__', _lt_from_ge)]
-}
+})
def total_ordering(cls):
"""Class decorator that fills in missing ordering methods"""
('+', '-'),
('*', '/', '%'),
)
-_binary_ops = {op: i for i, ops in enumerate(_binary_ops, 1) for op in ops}
-_c2py_ops = {'||': 'or', '&&': 'and', '/': '//'}
+_binary_ops = frozendict({op: i for i, ops in enumerate(_binary_ops, 1)
+ for op in ops})
+_c2py_ops = frozendict({'||': 'or', '&&': 'and', '/': '//'})
def _parse(tokens, priority=-1):
return self.__class__, (self.msg, self.doc, self.pos)
-_CONSTANTS = {
+_CONSTANTS = frozendict({
'-Infinity': NegInf,
'Infinity': PosInf,
'NaN': NaN,
-}
+})
HEXDIGITS = re.compile(r'[0-9A-Fa-f]{4}', FLAGS)
(?P<null>null)
''', re.VERBOSE)
-_group_to_theme_color = {
+_group_to_theme_color = frozendict({
"key": "definition",
"string": "string",
"number": "number",
"boolean": "keyword",
"null": "keyword",
-}
+})
def _colorize_json(json_str, theme):
hascompare = [opmap["COMPARE_OP"]]
-_cache_format = {
- "LOAD_GLOBAL": {
- "counter": 1,
- "index": 1,
- "module_keys_version": 1,
- "builtin_keys_version": 1,
- },
- "BINARY_OP": {
- "counter": 1,
- "descr": 4,
- },
- "UNPACK_SEQUENCE": {
- "counter": 1,
- },
- "COMPARE_OP": {
- "counter": 1,
- },
- "CONTAINS_OP": {
- "counter": 1,
- },
- "FOR_ITER": {
- "counter": 1,
- },
- "LOAD_SUPER_ATTR": {
- "counter": 1,
- },
- "LOAD_ATTR": {
- "counter": 1,
- "version": 2,
- "keys_version": 2,
- "descr": 4,
- },
- "STORE_ATTR": {
- "counter": 1,
- "version": 2,
- "index": 1,
- },
- "CALL": {
- "counter": 1,
- "func_version": 2,
- },
- "CALL_KW": {
- "counter": 1,
- "func_version": 2,
- },
- "CALL_FUNCTION_EX": {
- "counter": 1,
- },
- "STORE_SUBSCR": {
- "counter": 1,
- },
- "SEND": {
- "counter": 1,
- },
- "JUMP_BACKWARD": {
- "counter": 1,
- },
- "TO_BOOL": {
- "counter": 1,
- "version": 2,
- },
- "POP_JUMP_IF_TRUE": {
- "counter": 1,
- },
- "POP_JUMP_IF_FALSE": {
- "counter": 1,
- },
- "POP_JUMP_IF_NONE": {
- "counter": 1,
- },
- "POP_JUMP_IF_NOT_NONE": {
- "counter": 1,
- },
-}
+_cache_format = frozendict(
+ LOAD_GLOBAL=frozendict(
+ counter=1,
+ index=1,
+ module_keys_version=1,
+ builtin_keys_version=1,
+ ),
+ BINARY_OP=frozendict(
+ counter=1,
+ descr=4,
+ ),
+ UNPACK_SEQUENCE=frozendict(
+ counter=1,
+ ),
+ COMPARE_OP=frozendict(
+ counter=1,
+ ),
+ CONTAINS_OP=frozendict(
+ counter=1,
+ ),
+ FOR_ITER=frozendict(
+ counter=1,
+ ),
+ LOAD_SUPER_ATTR=frozendict(
+ counter=1,
+ ),
+ LOAD_ATTR=frozendict(
+ counter=1,
+ version=2,
+ keys_version=2,
+ descr=4,
+ ),
+ STORE_ATTR=frozendict(
+ counter=1,
+ version=2,
+ index=1,
+ ),
+ CALL=frozendict(
+ counter=1,
+ func_version=2,
+ ),
+ CALL_KW=frozendict(
+ counter=1,
+ func_version=2,
+ ),
+ CALL_FUNCTION_EX=frozendict(
+ counter=1,
+ ),
+ STORE_SUBSCR=frozendict(
+ counter=1,
+ ),
+ SEND=frozendict(
+ counter=1,
+ ),
+ JUMP_BACKWARD=frozendict(
+ counter=1,
+ ),
+ TO_BOOL=frozendict(
+ counter=1,
+ version=2,
+ ),
+ POP_JUMP_IF_TRUE=frozendict(
+ counter=1,
+ ),
+ POP_JUMP_IF_FALSE=frozendict(
+ counter=1,
+ ),
+ POP_JUMP_IF_NONE=frozendict(
+ counter=1,
+ ),
+ POP_JUMP_IF_NOT_NONE=frozendict(
+ counter=1,
+ ),
+)
-_inline_cache_entries = {
+_inline_cache_entries = frozendict({
name : sum(value.values()) for (name, value) in _cache_format.items()
-}
+})
def _parse_int(val):
return _parse_num(val, int)
-_builtin_cvt = { "int" : (_parse_int, _("integer")),
- "long" : (_parse_int, _("integer")),
- "float" : (float, _("floating-point")),
- "complex" : (complex, _("complex")) }
+_builtin_cvt = frozendict({
+ "int": (_parse_int, _("integer")),
+ "long": (_parse_int, _("integer")),
+ "float": (float, _("floating-point")),
+ "complex": (complex, _("complex")),
+})
def check_builtin(option, opt, value):
(cvt, what) = _builtin_cvt[option.type]
# Based on the description of the PHP's version_compare():
# http://php.net/manual/en/function.version-compare.php
-_ver_stages = {
+_ver_stages = frozendict({
# any string not found in this dict, will get 0 assigned
'dev': 10,
'alpha': 20, 'a': 20,
'RC': 50, 'rc': 50,
# number, will get 100 assigned
'pl': 200, 'p': 200,
-}
+})
def _comparable_version(version):
# Default values for architecture; non-empty strings override the
# defaults given as parameters
-_default_architecture = {
+_default_architecture = frozendict({
'win32': ('', 'WindowsPE'),
'win16': ('', 'Windows'),
'dos': ('', 'MSDOS'),
-}
+})
def architecture(executable=sys.executable, bits='', linkage=''):
def __init__(self, message="Invalid file"):
ValueError.__init__(self, message)
-_BINARY_FORMAT = {1: 'B', 2: 'H', 4: 'L', 8: 'Q'}
+_BINARY_FORMAT = frozendict({1: 'B', 2: 'H', 4: 'L', 8: 'Q'})
_undefined = object()
source=_ssl)
PROTOCOL_SSLv23 = _SSLMethod.PROTOCOL_SSLv23 = _SSLMethod.PROTOCOL_TLS
-_PROTOCOL_NAMES = {value: name for name, value in _SSLMethod.__members__.items()}
+_PROTOCOL_NAMES = frozendict({
+ value: name for name, value in _SSLMethod.__members__.items()})
_SSLv2_IF_EXISTS = getattr(_SSLMethod, 'PROTOCOL_SSLv2', None)
_flags = [('USE', USE)]
_flags.extend(kv for kv in globals().items() if kv[0].startswith('DEF_'))
_scopes_names = ('FREE', 'LOCAL', 'GLOBAL_IMPLICIT', 'GLOBAL_EXPLICIT', 'CELL')
-_scopes_value_to_name = {globals()[n]: n for n in _scopes_names}
+_scopes_value_to_name = frozendict({globals()[n]: n for n in _scopes_names})
def main(args):
return member.replace(**new_attrs, deep=False)
return member
-_NAMED_FILTERS = {
+_NAMED_FILTERS = frozendict({
"fully_trusted": fully_trusted_filter,
"tar": tar_filter,
"data": data_filter,
-}
+})
#------------------
# Exported Classes