Procházet zdrojové kódy

__repr__ and __str__ for ExclusionsDB (#5).

tags/v0.1^2
Ben Kurtovic před 12 roky
rodič
revize
1c2dcc999a
1 změnil soubory, kde provedl 9 přidání a 0 odebrání
  1. +9
    -0
      earwigbot/wiki/copyvios/exclusions.py

+ 9
- 0
earwigbot/wiki/copyvios/exclusions.py Zobrazit soubor

@@ -52,6 +52,15 @@ class ExclusionsDB(object):
self._logger = logger self._logger = logger
self._db_access_lock = Lock() self._db_access_lock = Lock()


def __repr__(self):
"""Return the canonical string representation of the ExclusionsDB."""
res = "ExclusionsDB(sitesdb={0!r}, dbfile={1!r}, logger={2!r})"
return res.format(self._sitesdb, self._dbfile, self._logger)

def __str__(self):
"""Return a nice string representation of the ExclusionsDB."""
return "<ExclusionsDB at {0}>".format(self._dbfile)

def _create(self): def _create(self):
"""Initialize the exclusions database with its necessary tables.""" """Initialize the exclusions database with its necessary tables."""
script = """ script = """


Načítá se…
Zrušit
Uložit