mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 02:04:04 +08:00
Merge pull request #9351 from nsoranzo/maketrans
Consistent "import" of maketrans
This commit is contained in:
@@ -20,11 +20,9 @@ import bx.intervals
|
||||
from six.moves import xrange
|
||||
|
||||
try:
|
||||
from string import maketrans
|
||||
except ImportError:
|
||||
maketrans = str.maketrans
|
||||
|
||||
assert sys.version_info[:2] >= (2, 6)
|
||||
except AttributeError:
|
||||
from string import maketrans
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -7,10 +7,6 @@ import string
|
||||
import tempfile
|
||||
import zipfile
|
||||
from json import dumps
|
||||
try:
|
||||
from string import maketrans
|
||||
except ImportError:
|
||||
maketrans = str.maketrans
|
||||
|
||||
from paste.httpexceptions import HTTPBadRequest, HTTPInternalServerError
|
||||
|
||||
@@ -30,13 +26,27 @@ from galaxy.managers import (
|
||||
)
|
||||
from galaxy.tools.actions import upload_common
|
||||
from galaxy.tools.parameters import populate_state
|
||||
from galaxy.util.path import full_path_permission_for_user, safe_contains, safe_relpath, unsafe_walk
|
||||
from galaxy.util.path import (
|
||||
full_path_permission_for_user,
|
||||
safe_contains,
|
||||
safe_relpath,
|
||||
unsafe_walk,
|
||||
)
|
||||
from galaxy.util.streamball import StreamBall
|
||||
from galaxy.web import (
|
||||
expose_api,
|
||||
expose_api_anonymous,
|
||||
)
|
||||
from galaxy.webapps.base.controller import BaseAPIController, UsesVisualizationMixin
|
||||
from galaxy.webapps.base.controller import (
|
||||
BaseAPIController,
|
||||
UsesVisualizationMixin,
|
||||
)
|
||||
|
||||
try:
|
||||
maketrans = str.maketrans
|
||||
except AttributeError:
|
||||
from string import maketrans
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import optparse
|
||||
import sqlite3
|
||||
import string
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import six
|
||||
try:
|
||||
maketrans = str.maketrans
|
||||
except AttributeError:
|
||||
from string import maketrans
|
||||
|
||||
|
||||
def stop_err(msg):
|
||||
@@ -33,10 +35,7 @@ def solid2sanger(quality_string, min_qual=0):
|
||||
def Translator(frm='', to='', delete=''):
|
||||
if len(to) == 1:
|
||||
to = to * len(frm)
|
||||
if six.PY2:
|
||||
trans = string.maketrans(frm, to)
|
||||
else:
|
||||
trans = str.maketrans(frm, to)
|
||||
trans = maketrans(frm, to)
|
||||
|
||||
def callable(s):
|
||||
return s.translate(trans, delete)
|
||||
|
||||
Reference in New Issue
Block a user