Method
__init__
(self, filename, plugin_instance)
Source from the content-addressed store, hash-verified
| 115 | """ |
| 116 | |
| 117 | def __init__(self, filename, plugin_instance): |
| 118 | self.complete = False |
| 119 | # Expected size in bytes of full file transfer |
| 120 | self.size = 0 |
| 121 | # List of tuples indicating byte chunks already received and written to |
| 122 | # disk |
| 123 | self.ranges = [] |
| 124 | self.plugin = plugin_instance |
| 125 | self.filename = filename |
| 126 | try: |
| 127 | self.fh = open(filename, 'wb') |
| 128 | except IOError as e: |
| 129 | self.plugin.error( |
| 130 | "Could not create file {!r}: {!s}".format(filename, e)) |
| 131 | self.fh = None |
| 132 | |
| 133 | def __del__(self): |
| 134 | if self.fh is None: |
Tested by
no test coverage detected