Created
July 10, 2016 19:48
-
-
Save lzkelley/c3979c20eda7fedc011c4b565a894647 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def some_task(catalog, ...): | |
... | |
data, changed = catalog.load_url(url, path) | |
# If the data is not changed, and we are updating... we're done | |
if not changed and catalog.args.update: | |
return | |
# Continue processing, update data blah blah blah | |
... | |
return | |
class Catalog: | |
... | |
def load_url(self, url, path, write=True): | |
# Load cached data... | |
if self.args.archive: | |
data = self._load_cached_url(path) | |
# Load data from url | |
else: | |
data = self._load_url_data(url) | |
# Check if the data is changed | |
... | |
changed = ... | |
# Save url data to cache | |
if write: | |
... | |
return data, changed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment