PK\LKK"" bootle.py""" “Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration.” -- Stan Kelly-Bootle """ import math __version__ = "0.1.0" def _transform_index(index, allow_none=False): if index is None and allow_none: return None if isinstance(index, slice): try: return slice( _transform_index(index.start, allow_none=True), _transform_index(index.stop, allow_none=True), index.step, ) except TypeError: raise TypeError("slice indices must be floats or None") if not isinstance(index, float): raise TypeError( "half-indexed indices must be floats or slices, not {}".format( type(index).__name__ ) ) if index % 1 != 0.5: raise ValueError("half-indexed indices must have a 0.5 fractional component") return math.floor(index) class List(list): """A list-like object that is indexed from 0.5.""" def __delitem__(self, item): return super().__delitem__(_transform_index(item)) def __getitem__(self, item): return super().__getitem__(_transform_index(item)) def __setitem__(self, item, value): return super().__setitem__(_transform_index(item), value) def index(self, value, start=0.5, stop=4503599627370495.5): "Return first index of value." n = super().index(value, _transform_index(start), _transform_index(stop)) return n + 0.5 def insert(self, index, value): "Insert object before index." return super().__setitem__(_transform_index(index), value) def pop(self, index=-0.5): "Remove and return item at index (default last)." return super().pop(_transform_index(index)) PKZL|"bootle-0.1.0.dist-info/LICENSE.txt DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO. PK!HNObootle-0.1.0.dist-info/WHEEL HM K-*ϳR03rOK-J,/RH,zd&Y)r$[)T&UrPK!Hpybootle-0.1.0.dist-info/METADATAT]O0}/05IӊEXL JAViU561$qf;?ds]i{*!csϹsý/E-?d}c)MlsCUs UW/Am2 4A*b SJB#ڇ9נcv*sJhjL HIO@jaPJ z?_[T.3 ]zsE eòk^ ڻZiS~ǨJRda0Ͳ$= P(Z@R>Gd乩4DnV̆1n ,hu+앒y.zH**ouv[31\"8;\h<9L.j"Fm;_yCc-U2C}!,sH&\e3ǸT-WId 3qQ؀V=FEB,2C{QXo1G =ǥn] -[K(|Nʾ)Txw}?~EεqTq`/6m5 >h~jl'NC&N-k:o0pNC<rCmh+#uɿe. R$hJ.oRG,|Xp_I/oN!]?cÛW=~PK!H qgbootle-0.1.0.dist-info/RECORDur0л%z@ *Ke0P:׷;J% Z]\?=l4nC@1bDYR$Y:aeh ']pp߷%1^:nm|Ȳ\`jsrM