Skip to content

Commit

Permalink
Remove gettext import guards
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasr8 committed Nov 3, 2024
1 parent 556dc9b commit 75bae45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
7 changes: 2 additions & 5 deletions Lib/getopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,8 @@
__all__ = ["GetoptError","error","getopt","gnu_getopt"]

import os
try:
from gettext import gettext as _
except ImportError:
# Bootstrapping Python: gettext's dependencies not built yet
def _(s): return s
from gettext import gettext as _


class GetoptError(Exception):
opt = ''
Expand Down
15 changes: 2 additions & 13 deletions Lib/optparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@

import sys, os
import textwrap
from gettext import gettext as _, ngettext


def _repr(self):
return "<%s at 0x%x: %s>" % (self.__class__.__name__, id(self), self)
Expand All @@ -86,19 +88,6 @@ def _repr(self):
# Id: help.py 527 2006-07-23 15:21:30Z greg
# Id: errors.py 509 2006-04-20 00:58:24Z gward

try:
from gettext import gettext, ngettext
except ImportError:
def gettext(message):
return message

def ngettext(singular, plural, n):
if n == 1:
return singular
return plural

_ = gettext


class OptParseError (Exception):
def __init__(self, msg):
Expand Down

0 comments on commit 75bae45

Please sign in to comment.