Skip to content

Commit

Permalink
Move ngettext alias to a shared module
Browse files Browse the repository at this point in the history
To be used by other modules.
  • Loading branch information
victorlin committed Aug 21, 2024
1 parent 1e9d131 commit 3a9fdbd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
7 changes: 7 additions & 0 deletions augur/io/print.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import gettext
import sys

from augur.debug import DEBUGGING
Expand All @@ -13,3 +14,9 @@ def print_debug(*args):
"""Print to stderr if in debugging mode."""
if DEBUGGING:
print_err(*args)


# Use ngettext() without a message catalog for its singular/plural handling so
# we can make proper error messages. gettext() (no "n") is conventionally
# aliased as "_", so alias ngettext() as "_n".
_n = gettext.NullTranslations().ngettext
9 changes: 1 addition & 8 deletions augur/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
you want to use a version different from what's on PATH), set the SQLITE3
environment variable to path of the desired sqlite3 executable.
"""
import gettext
import os
import re
import subprocess
Expand All @@ -48,19 +47,13 @@
from augur.argparse_ import ExtendOverwriteDefault, SKIP_AUTO_DEFAULT_IN_HELP
from augur.errors import AugurError
from augur.io.metadata import DEFAULT_DELIMITERS, DEFAULT_ID_COLUMNS, Metadata
from augur.io.print import print_err, print_debug
from augur.io.print import print_err, print_debug, _n
from augur.utils import first_line


T = TypeVar('T')


# Use ngettext() without a message catalog for its singular/plural handling so
# we can make proper error messages. gettext() (no "n") is conventionally
# aliased as "_", so alias ngettext() as "_n".
_n = gettext.NullTranslations().ngettext


class NamedMetadata(Metadata):
name: str
"""User-provided descriptive name for this metadata file."""
Expand Down

0 comments on commit 3a9fdbd

Please sign in to comment.