| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | - # -*- coding: utf-8 -*- | ||
| 2 | 1 | # | |
| 3 | 2 | # GitDB documentation build configuration file, created by | |
| 4 | 3 | # sphinx-quickstart on Wed Jun 30 00:01:32 2010. | |
@@ -38,8 +37,8 @@ | |||
| 38 | 37 | master_doc = 'index' | |
| 39 | 38 | ||
| 40 | 39 | # General information about the project. | |
| 41 | - project = u'GitDB' | ||
| 42 | - copyright = u'2011, Sebastian Thiel' | ||
| 40 | + project = 'GitDB' | ||
| 41 | + copyright = '2011, Sebastian Thiel' | ||
| 43 | 42 | ||
| 44 | 43 | # The version info for the project you're documenting, acts as replacement for | |
| 45 | 44 | # |version| and |release|, also used in various other places throughout the | |
@@ -172,8 +171,8 @@ | |||
| 172 | 171 | # Grouping the document tree into LaTeX files. List of tuples | |
| 173 | 172 | # (source start file, target name, title, author, documentclass [howto/manual]). | |
| 174 | 173 | latex_documents = [ | |
| 175 | - ('index', 'GitDB.tex', u'GitDB Documentation', | ||
| 176 | - u'Sebastian Thiel', 'manual'), | ||
| 174 | + ('index', 'GitDB.tex', 'GitDB Documentation', | ||
| 175 | + 'Sebastian Thiel', 'manual'), | ||
| 177 | 176 | ] | |
| 178 | 177 | ||
| 179 | 178 | # The name of an image file (relative to this directory) to place at the top of | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,7 +22,7 @@ | |||
| 22 | 22 | __all__ = ('ObjectDBR', 'ObjectDBW', 'FileDBBase', 'CompoundDB', 'CachingDB') | |
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | - class ObjectDBR(object): | ||
| 25 | + class ObjectDBR: | ||
| 26 | 26 | ||
| 27 | 27 | """Defines an interface for object database lookup. | |
| 28 | 28 | Objects are identified either by their 20 byte bin sha""" | |
@@ -63,7 +63,7 @@ def sha_iter(self): | |||
| 63 | 63 | #} END query interface | |
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | - class ObjectDBW(object): | ||
| 66 | + class ObjectDBW: | ||
| 67 | 67 | ||
| 68 | 68 | """Defines an interface to create objects in the database""" | |
| 69 | 69 | ||
@@ -105,7 +105,7 @@ def store(self, istream): | |||
| 105 | 105 | #} END edit interface | |
| 106 | 106 | ||
| 107 | 107 | ||
| 108 | - class FileDBBase(object): | ||
| 108 | + class FileDBBase: | ||
| 109 | 109 | ||
| 110 | 110 | """Provides basic facilities to retrieve files of interest, including | |
| 111 | 111 | caching facilities to help mapping hexsha's to objects""" | |
@@ -117,7 +117,7 @@ def __init__(self, root_path): | |||
| 117 | 117 | **Note:** The base will not perform any accessablity checking as the base | |
| 118 | 118 | might not yet be accessible, but become accessible before the first | |
| 119 | 119 | access.""" | |
| 120 | - super(FileDBBase, self).__init__() | ||
| 120 | + super().__init__() | ||
| 121 | 121 | self._root_path = root_path | |
| 122 | 122 | ||
| 123 | 123 | #{ Interface | |
@@ -133,7 +133,7 @@ def db_path(self, rela_path): | |||
| 133 | 133 | #} END interface | |
| 134 | 134 | ||
| 135 | 135 | ||
| 136 | - class CachingDB(object): | ||
| 136 | + class CachingDB: | ||
| 137 | 137 | ||
| 138 | 138 | """A database which uses caches to speed-up access""" | |
| 139 | 139 | ||
@@ -176,7 +176,7 @@ def _set_cache_(self, attr): | |||
| 176 | 176 | elif attr == '_db_cache': | |
| 177 | 177 | self._db_cache = dict() | |
| 178 | 178 | else: | |
| 179 | - super(CompoundDB, self)._set_cache_(attr) | ||
| 179 | + super()._set_cache_(attr) | ||
| 180 | 180 | ||
| 181 | 181 | def _db_query(self, sha): | |
| 182 | 182 | """:return: database containing the given 20 byte sha | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,7 +39,7 @@ class GitDB(FileDBBase, ObjectDBW, CompoundDB): | |||
| 39 | 39 | ||
| 40 | 40 | def __init__(self, root_path): | |
| 41 | 41 | """Initialize ourselves on a git objects directory""" | |
| 42 | - super(GitDB, self).__init__(root_path) | ||
| 42 | + super().__init__(root_path) | ||
| 43 | 43 | ||
| 44 | 44 | def _set_cache_(self, attr): | |
| 45 | 45 | if attr == '_dbs' or attr == '_loose_db': | |
@@ -68,7 +68,7 @@ def _set_cache_(self, attr): | |||
| 68 | 68 | # finally set the value | |
| 69 | 69 | self._loose_db = loose_db | |
| 70 | 70 | else: | |
| 71 | - super(GitDB, self)._set_cache_(attr) | ||
| 71 | + super()._set_cache_(attr) | ||
| 72 | 72 | # END handle attrs | |
| 73 | 73 | ||
| 74 | 74 | #{ ObjectDBW interface | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -75,7 +75,7 @@ class LooseObjectDB(FileDBBase, ObjectDBR, ObjectDBW): | |||
| 75 | 75 | new_objects_mode = int("644", 8) | |
| 76 | 76 | ||
| 77 | 77 | def __init__(self, root_path): | |
| 78 | - super(LooseObjectDB, self).__init__(root_path) | ||
| 78 | + super().__init__(root_path) | ||
| 79 | 79 | self._hexsha_to_file = dict() | |
| 80 | 80 | # Additional Flags - might be set to 0 after the first failure | |
| 81 | 81 | # Depending on the root, this might work for some mounts, for others not, which | |
@@ -151,7 +151,7 @@ def set_ostream(self, stream): | |||
| 151 | 151 | """:raise TypeError: if the stream does not support the Sha1Writer interface""" | |
| 152 | 152 | if stream is not None and not isinstance(stream, Sha1Writer): | |
| 153 | 153 | raise TypeError("Output stream musst support the %s interface" % Sha1Writer.__name__) | |
| 154 | - return super(LooseObjectDB, self).set_ostream(stream) | ||
| 154 | + return super().set_ostream(stream) | ||
| 155 | 155 | ||
| 156 | 156 | def info(self, sha): | |
| 157 | 157 | m = self._map_loose_object(sha) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,7 +37,7 @@ class MemoryDB(ObjectDBR, ObjectDBW): | |||
| 37 | 37 | exists in the target storage before introducing actual IO""" | |
| 38 | 38 | ||
| 39 | 39 | def __init__(self): | |
| 40 | - super(MemoryDB, self).__init__() | ||
| 40 | + super().__init__() | ||
| 41 | 41 | self._db = LooseObjectDB("path/doesnt/matter") | |
| 42 | 42 | ||
| 43 | 43 | # maps 20 byte shas to their OStream objects | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,7 +39,7 @@ class PackedDB(FileDBBase, ObjectDBR, CachingDB, LazyMixin): | |||
| 39 | 39 | _sort_interval = 500 | |
| 40 | 40 | ||
| 41 | 41 | def __init__(self, root_path): | |
| 42 | - super(PackedDB, self).__init__(root_path) | ||
| 42 | + super().__init__(root_path) | ||
| 43 | 43 | # list of lists with three items: | |
| 44 | 44 | # * hits - number of times the pack was hit with a request | |
| 45 | 45 | # * entity - Pack entity instance | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,15 +20,15 @@ class ReferenceDB(CompoundDB): | |||
| 20 | 20 | ObjectDBCls = None | |
| 21 | 21 | ||
| 22 | 22 | def __init__(self, ref_file): | |
| 23 | - super(ReferenceDB, self).__init__() | ||
| 23 | + super().__init__() | ||
| 24 | 24 | self._ref_file = ref_file | |
| 25 | 25 | ||
| 26 | 26 | def _set_cache_(self, attr): | |
| 27 | 27 | if attr == '_dbs': | |
| 28 | 28 | self._dbs = list() | |
| 29 | 29 | self._update_dbs_from_ref_file() | |
| 30 | 30 | else: | |
| 31 | - super(ReferenceDB, self)._set_cache_(attr) | ||
| 31 | + super()._set_cache_(attr) | ||
| 32 | 32 | # END handle attrs | |
| 33 | 33 | ||
| 34 | 34 | def _update_dbs_from_ref_file(self): | |
@@ -44,7 +44,7 @@ def _update_dbs_from_ref_file(self): | |||
| 44 | 44 | try: | |
| 45 | 45 | with codecs.open(self._ref_file, 'r', encoding="utf-8") as f: | |
| 46 | 46 | ref_paths = [l.strip() for l in f] | |
| 47 | - except (OSError, IOError): | ||
| 47 | + except OSError: | ||
| 48 | 48 | pass | |
| 49 | 49 | # END handle alternates | |
| 50 | 50 | ||
@@ -79,4 +79,4 @@ def _update_dbs_from_ref_file(self): | |||
| 79 | 79 | def update_cache(self, force=False): | |
| 80 | 80 | # re-read alternates and update databases | |
| 81 | 81 | self._update_dbs_from_ref_file() | |
| 82 | - return super(ReferenceDB, self).update_cache(force) | ||
| 82 | + return super().update_cache(force) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -113,7 +113,7 @@ def delta_chunk_apply(dc, bbuf, write): | |||
| 113 | 113 | # END handle chunk mode | |
| 114 | 114 | ||
| 115 | 115 | ||
| 116 | - class DeltaChunk(object): | ||
| 116 | + class DeltaChunk: | ||
| 117 | 117 | ||
| 118 | 118 | """Represents a piece of a delta, it can either add new data, or copy existing | |
| 119 | 119 | one from a source buffer""" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -170,7 +170,7 @@ def write_stream_to_pack(read, write, zstream, base_crc=None): | |||
| 170 | 170 | #} END utilities | |
| 171 | 171 | ||
| 172 | 172 | ||
| 173 | - class IndexWriter(object): | ||
| 173 | + class IndexWriter: | ||
| 174 | 174 | ||
| 175 | 175 | """Utility to cache index information, allowing to write all information later | |
| 176 | 176 | in one go to the given stream | |
@@ -257,7 +257,7 @@ class PackIndexFile(LazyMixin): | |||
| 257 | 257 | index_version_default = 2 | |
| 258 | 258 | ||
| 259 | 259 | def __init__(self, indexpath): | |
| 260 | - super(PackIndexFile, self).__init__() | ||
| 260 | + super().__init__() | ||
| 261 | 261 | self._indexpath = indexpath | |
| 262 | 262 | ||
| 263 | 263 | def close(self): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -219,13 +219,13 @@ def read(self, size=-1): | |||
| 219 | 219 | # END clamp size | |
| 220 | 220 | ||
| 221 | 221 | if size == 0: | |
| 222 | - return bytes() | ||
| 222 | + return b'' | ||
| 223 | 223 | # END handle depletion | |
| 224 | 224 | ||
| 225 | 225 | # deplete the buffer, then just continue using the decompress object | |
| 226 | 226 | # which has an own buffer. We just need this to transparently parse the | |
| 227 | 227 | # header from the zlib stream | |
| 228 | - dat = bytes() | ||
| 228 | + dat = b'' | ||
| 229 | 229 | if self._buf: | |
| 230 | 230 | if self._buflen >= size: | |
| 231 | 231 | # have enough data | |
@@ -553,7 +553,7 @@ def size(self): | |||
| 553 | 553 | ||
| 554 | 554 | #{ W Streams | |
| 555 | 555 | ||
| 556 | - class Sha1Writer(object): | ||
| 556 | + class Sha1Writer: | ||
| 557 | 557 | ||
| 558 | 558 | """Simple stream writer which produces a sha whenever you like as it degests | |
| 559 | 559 | everything it is supposed to write""" | |
@@ -650,7 +650,7 @@ class FDCompressedSha1Writer(Sha1Writer): | |||
| 650 | 650 | exc = IOError("Failed to write all bytes to filedescriptor") | |
| 651 | 651 | ||
| 652 | 652 | def __init__(self, fd): | |
| 653 | - super(FDCompressedSha1Writer, self).__init__() | ||
| 653 | + super().__init__() | ||
| 654 | 654 | self.fd = fd | |
| 655 | 655 | self.zip = zlib.compressobj(zlib.Z_BEST_SPEED) | |
| 656 | 656 | ||
@@ -677,7 +677,7 @@ def close(self): | |||
| 677 | 677 | #} END stream interface | |
| 678 | 678 | ||
| 679 | 679 | ||
| 680 | - class FDStream(object): | ||
| 680 | + class FDStream: | ||
| 681 | 681 | ||
| 682 | 682 | """A simple wrapper providing the most basic functions on a file descriptor | |
| 683 | 683 | with the fileobject interface. Cannot use os.fdopen as the resulting stream | |
@@ -711,7 +711,7 @@ def close(self): | |||
| 711 | 711 | close(self._fd) | |
| 712 | 712 | ||
| 713 | 713 | ||
| 714 | - class NullStream(object): | ||
| 714 | + class NullStream: | ||
| 715 | 715 | ||
| 716 | 716 | """A stream that does nothing but providing a stream interface. | |
| 717 | 717 | Use it like /dev/null""" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments