OLD | NEW |
1 # Copyright 2011 Google Inc. | 1 # Copyright 2011 Google Inc. |
2 # | 2 # |
3 # Licensed under the Apache License, Version 2.0 (the "License"); | 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
4 # you may not use this file except in compliance with the License. | 4 # you may not use this file except in compliance with the License. |
5 # You may obtain a copy of the License at | 5 # You may obtain a copy of the License at |
6 # | 6 # |
7 # http://www.apache.org/licenses/LICENSE-2.0 | 7 # http://www.apache.org/licenses/LICENSE-2.0 |
8 # | 8 # |
9 # Unless required by applicable law or agreed to in writing, software | 9 # Unless required by applicable law or agreed to in writing, software |
10 # distributed under the License is distributed on an "AS IS" BASIS, | 10 # distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 17 matching lines...) Expand all Loading... |
28 f.unlock_and_close() | 28 f.unlock_and_close() |
29 """ | 29 """ |
30 | 30 |
31 __author__ = 'cache@google.com (David T McWherter)' | 31 __author__ = 'cache@google.com (David T McWherter)' |
32 | 32 |
33 import errno | 33 import errno |
34 import logging | 34 import logging |
35 import os | 35 import os |
36 import time | 36 import time |
37 | 37 |
38 from oauth2client import util | 38 from . import util |
39 | 39 |
40 logger = logging.getLogger(__name__) | 40 logger = logging.getLogger(__name__) |
41 | 41 |
42 | 42 |
43 class CredentialsFileSymbolicLinkError(Exception): | 43 class CredentialsFileSymbolicLinkError(Exception): |
44 """Credentials files must not be symbolic links.""" | 44 """Credentials files must not be symbolic links.""" |
45 | 45 |
46 | 46 |
47 class AlreadyLockedException(Exception): | 47 class AlreadyLockedException(Exception): |
48 """Trying to lock a file that has already been locked by the LockedFile.""" | 48 """Trying to lock a file that has already been locked by the LockedFile.""" |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 364 |
365 Raises: | 365 Raises: |
366 AlreadyLockedException: if the lock is already acquired. | 366 AlreadyLockedException: if the lock is already acquired. |
367 IOError: if the open fails. | 367 IOError: if the open fails. |
368 """ | 368 """ |
369 self._opener.open_and_lock(timeout, delay) | 369 self._opener.open_and_lock(timeout, delay) |
370 | 370 |
371 def unlock_and_close(self): | 371 def unlock_and_close(self): |
372 """Unlock and close a file.""" | 372 """Unlock and close a file.""" |
373 self._opener.unlock_and_close() | 373 self._opener.unlock_and_close() |
OLD | NEW |