| Total Complexity | 5 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Coverage | 88.24% |
| 1 | 1 | import os |
|
| 4 | 1 | class ImageStore: |
|
| 5 | |||
| 6 | 1 | LATEST = "latest.jpg" |
|
| 7 | |||
| 8 | 1 | def __init__(self, root): |
|
| 9 | 1 | self.root = root |
|
| 10 | |||
| 11 | 1 | @property |
|
| 12 | def latest(self): |
||
| 13 | 1 | return os.path.join(self.root, self.LATEST) |
|
| 14 | |||
| 15 | 1 | def exists(self, image): |
|
| 16 | 1 | image.root = self.root |
|
| 17 | 1 | return os.path.isfile(image.path) |
|
| 18 | |||
| 19 | 1 | def create(self, image): |
|
| 20 | 1 | image.root = self.root |
|
| 21 | 1 | image.generate() |
|
| 22 | 1 | try: |
|
| 23 | 1 | os.remove(self.latest) |
|
| 24 | except IOError: |
||
| 25 | pass |
||
| 26 | os.symlink(image.path, self.latest) |
||
| 27 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.