Skip to content

Instantly share code, notes, and snippets.

@rmariano
Created April 28, 2024 13:36
Show Gist options
  • Save rmariano/b6587a30203674da35d2239e50a969db to your computer and use it in GitHub Desktop.
Save rmariano/b6587a30203674da35d2239e50a969db to your computer and use it in GitHub Desktop.
"""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