Created
April 28, 2024 13:36
-
-
Save rmariano/b6587a30203674da35d2239e50a969db 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
"""Mutable objects as class attributes.""" | |
import logging | |
logger = logging.getLogger(__name__) | |
class Query: | |
PARAMETERS = {"limit": 100, "offset": 0} | |
def run_query(self, query, limit=None, offset=None): | |
if limit is not None: | |
self.PARAMETERS.update(limit=limit) | |
if offset is not None: | |
self.PARAMETERS.update(offset=offset) | |
return self._run(query, **self.PARAMETERS) | |
@staticmethod | |
def _run(query, limit, offset): | |
logger.info("running %s [%s, %s]", query, limit, offset) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment