kopia lustrzana https://github.com/corrscope/corrscope
delete unused code
rodzic
3d13666a72
commit
e049260044
37
config.py
37
config.py
|
|
@ -1,37 +0,0 @@
|
|||
|
||||
|
||||
|
||||
# class EnumBodyDict(dict):
|
||||
# """ https://news.ycombinator.com/item?id=5691483 """
|
||||
# def __init__(self, *a, **kw):
|
||||
# self._keys_accessed = []
|
||||
# dict.__init__(self, *a, **kw)
|
||||
#
|
||||
# def __getitem__(self, key):
|
||||
# self._keys_accessed.append(key)
|
||||
# return dict.__getitem__(self, key)
|
||||
#
|
||||
#
|
||||
# class EnumMeta(type):
|
||||
# @classmethod
|
||||
# def __prepare__(metacls, name, bases):
|
||||
# return EnumBodyDict()
|
||||
#
|
||||
# def __new__(cls, name, bases, classdict):
|
||||
# next_enum_value = max(classdict.values()) + 1
|
||||
#
|
||||
# for name in classdict._keys_accessed:
|
||||
# if name not in classdict:
|
||||
# classdict[name] = next_enum_value
|
||||
# next_enum_value += 1
|
||||
#
|
||||
# return type.__new__(cls, name, bases, classdict)
|
||||
#
|
||||
#
|
||||
# class Enum(object, metaclass=EnumMeta):
|
||||
#
|
||||
#
|
||||
# # proposed enum implementation here
|
||||
#
|
||||
# # class Config(metaclass=Struct):
|
||||
#
|
||||
|
|
@ -1,40 +1,2 @@
|
|||
# import itertools
|
||||
#
|
||||
#
|
||||
# class ExhaustedError(Exception):
|
||||
# def __init__(self, index):
|
||||
# """The index is the 0-based index of the exhausted iterable."""
|
||||
# self.index = index
|
||||
#
|
||||
#
|
||||
# def raising_iter(i):
|
||||
# """Return an iterator that raises an ExhaustedError."""
|
||||
# raise ExhaustedError(i)
|
||||
# yield
|
||||
#
|
||||
#
|
||||
# def terminate_iter(i, iterable):
|
||||
# """Return an iterator that raises an ExhaustedError at the end."""
|
||||
# return itertools.chain(iterable, raising_iter(i))
|
||||
#
|
||||
#
|
||||
# def zip_equal(*iterables):
|
||||
# iterators = [terminate_iter(*args) for args in enumerate(iterables)]
|
||||
# try:
|
||||
# yield from zip(*iterators)
|
||||
# except ExhaustedError as exc:
|
||||
# index = exc.index
|
||||
# if index > 0:
|
||||
# raise RuntimeError('iterable {} exhausted first'.format(index)) from None
|
||||
# # Check that all other iterators are also exhausted.
|
||||
# for i, iterator in enumerate(iterators[1:], start=1):
|
||||
# try:
|
||||
# next(iterator)
|
||||
# except ExhaustedError:
|
||||
# pass
|
||||
# else:
|
||||
# raise RuntimeError('iterable {} is longer'.format(i)) from None
|
||||
|
||||
|
||||
def ceildiv(n, d):
|
||||
return -(-n // d)
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue