⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compat.py

📁 SQLAlchemy. 经典的Python ORM框架。学习必看。
💻 PY
字号:
import itertools, new, sys, warnings__all__ = 'set', 'frozenset', 'sorted', '_function_named'try:    set = setexcept NameError:    import sets    # keep this in sync with sqlalchemy.util.Set    # can't just import it in testlib because of coverage, load order, etc.    class set(sets.Set):        def _binary_sanity_check(self, other):            pass        def issubset(self, iterable):            other = type(self)(iterable)            return sets.Set.issubset(self, other)        def __le__(self, other):            sets.Set._binary_sanity_check(self, other)            return sets.Set.__le__(self, other)        def issuperset(self, iterable):            other = type(self)(iterable)            return sets.Set.issuperset(self, other)        def __ge__(self, other):            sets.Set._binary_sanity_check(self, other)            return sets.Set.__ge__(self, other)        # lt and gt still require a BaseSet        def __lt__(self, other):            sets.Set._binary_sanity_check(self, other)            return sets.Set.__lt__(self, other)        def __gt__(self, other):            sets.Set._binary_sanity_check(self, other)            return sets.Set.__gt__(self, other)        def __ior__(self, other):            if not isinstance(other, sets.BaseSet):                return NotImplemented            return sets.Set.__ior__(self, other)        def __iand__(self, other):            if not isinstance(other, sets.BaseSet):                return NotImplemented            return sets.Set.__iand__(self, other)        def __ixor__(self, other):            if not isinstance(other, sets.BaseSet):                return NotImplemented            return sets.Set.__ixor__(self, other)        def __isub__(self, other):            if not isinstance(other, sets.BaseSet):                return NotImplemented            return sets.Set.__isub__(self, other)try:    frozenset = frozensetexcept NameError:    import sets    from sets import ImmutableSet as frozensettry:    sorted = sortedexcept NameError:    def sorted(iterable, cmp=None):        l = list(iterable)        if cmp:            l.sort(cmp)        else:            l.sort()        return ldef _function_named(fn, newname):    try:        fn.__name__ = newname    except:        fn = new.function(fn.func_code, fn.func_globals, newname,                          fn.func_defaults, fn.func_closure)    return fn

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -