mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fix Python 2.7 lint errors
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
"""
|
||||
Contains implementations of the authentication logic.
|
||||
"""
|
||||
import errno
|
||||
import logging
|
||||
|
||||
from galaxy.auth.util import get_authenticators, parse_auth_results
|
||||
@@ -16,7 +15,7 @@ class AuthManager(object):
|
||||
def __init__(self, app):
|
||||
self.__app = app
|
||||
self.redact_username_in_logs = app.config.redact_username_in_logs
|
||||
self.authenticators = get_authenticators(app.config.auth_config_file)
|
||||
self.authenticators = get_authenticators(app.config.auth_config_file, app.config.auth_config_file_set)
|
||||
|
||||
def check_registration_allowed(self, email, username, password):
|
||||
"""Checks if the provided email/username is allowed to register."""
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import errno
|
||||
import logging
|
||||
import xml.etree.ElementTree
|
||||
from collections import namedtuple
|
||||
@@ -24,14 +25,14 @@ AUTH_CONF_XML = """<?xml version="1.0"?>
|
||||
Authenticator = namedtuple('Authenticator', ['plugin', 'filter_template', 'options'])
|
||||
|
||||
|
||||
def get_authenticators(auth_config_file):
|
||||
def get_authenticators(auth_config_file, auth_config_file_set):
|
||||
__plugins_dict = plugin_config.plugins_dict(galaxy.auth.providers, 'plugin_type')
|
||||
# parse XML
|
||||
try:
|
||||
ct = xml.etree.ElementTree.parse(auth_config_file)
|
||||
conf_root = ct.getroot()
|
||||
except (OSError, IOError) as exc:
|
||||
if exc.errno == errno.ENOENT and not app.config.auth_config_file_set:
|
||||
if exc.errno == errno.ENOENT and not auth_config_file_set:
|
||||
conf_root = xml.etree.ElementTree.fromstring(AUTH_CONF_XML)
|
||||
else:
|
||||
raise
|
||||
|
||||
@@ -217,18 +217,18 @@ class BaseAppConfiguration(object):
|
||||
|
||||
def _parse_config_file_options(self, defaults, listify_defaults, config_kwargs):
|
||||
for var, defaults in defaults.items():
|
||||
if config_kwargs.get( var, None ) is not None:
|
||||
path = config_kwargs.get( var )
|
||||
setattr( self, var + '_set', True )
|
||||
if config_kwargs.get(var, None) is not None:
|
||||
path = config_kwargs.get(var)
|
||||
setattr(self, var + '_set', True)
|
||||
else:
|
||||
for default in defaults:
|
||||
if os.path.exists( resolve_path( default, self.root ) ):
|
||||
if os.path.exists(resolve_path(default, self.root)):
|
||||
path = default
|
||||
break
|
||||
else:
|
||||
path = defaults[-1]
|
||||
setattr( self, var + '_set', False )
|
||||
setattr( self, var, resolve_path( path, self.root ) )
|
||||
setattr(self, var + '_set', False)
|
||||
setattr(self, var, resolve_path(path, self.root))
|
||||
|
||||
for var, defaults in listify_defaults.items():
|
||||
paths = []
|
||||
@@ -326,7 +326,7 @@ class GalaxyAppConfiguration(BaseAppConfiguration):
|
||||
self.oidc = []
|
||||
# The value of migrated_tools_config is the file reserved for containing only those tools that have been eliminated from the distribution
|
||||
# and moved to the tool shed. It is created on demand.
|
||||
self.integrated_tool_panel_config = resolve_path(kwargs.get('integrated_tool_panel_config', 'integrated_tool_panel.xml' ), self.mutable_config_dir)
|
||||
self.integrated_tool_panel_config = resolve_path(kwargs.get('integrated_tool_panel_config', 'integrated_tool_panel.xml'), self.mutable_config_dir)
|
||||
integrated_tool_panel_tracking_directory = kwargs.get('integrated_tool_panel_tracking_directory', None)
|
||||
if integrated_tool_panel_tracking_directory:
|
||||
self.integrated_tool_panel_tracking_directory = resolve_path(integrated_tool_panel_tracking_directory, self.root)
|
||||
@@ -603,7 +603,7 @@ class GalaxyAppConfiguration(BaseAppConfiguration):
|
||||
self.tool_test_data_directories = kwargs.get("tool_test_data_directories", default_tool_test_data_directories)
|
||||
# Location for tool dependencies.
|
||||
use_tool_dependencies, tool_dependency_dir, use_cached_dependency_manager, tool_dependency_cache_dir, precache_dependencies = \
|
||||
parse_dependency_options(kwargs, self.root, self.dependency_resolvers_config_file)
|
||||
parse_dependency_options(kwargs, self.data_dir, self.dependency_resolvers_config_file)
|
||||
self.use_tool_dependencies = use_tool_dependencies
|
||||
self.tool_dependency_dir = tool_dependency_dir
|
||||
self.use_cached_dependency_manager = use_cached_dependency_manager
|
||||
@@ -1064,7 +1064,7 @@ def parse_dependency_options(kwargs, root, dependency_resolvers_config_file):
|
||||
tool_dependency_dir = None
|
||||
|
||||
if tool_dependency_dir is not None:
|
||||
tool_dependency_dir = resolve_path(tool_dependency_dir, self.data_dir)
|
||||
tool_dependency_dir = resolve_path(tool_dependency_dir, root)
|
||||
# Setting the following flag to true will ultimately cause tool dependencies
|
||||
# to be located in the shell environment and used by the job that is executing
|
||||
# the tool.
|
||||
|
||||
@@ -166,7 +166,7 @@ def _handle_galaxy_ini(args, config_dir, data_dir):
|
||||
|
||||
galaxy_config_template = []
|
||||
with open(GALAXY_CONFIG_TEMPLATE_FILE) as fh:
|
||||
for line in [ l.rstrip('\n') for l in fh.readlines() ]:
|
||||
for line in [l.rstrip('\n') for l in fh.readlines()]:
|
||||
for k, v in GALAXY_CONFIG_SUBSTITUTIONS.items():
|
||||
if line == k:
|
||||
line = v
|
||||
|
||||
@@ -9,7 +9,7 @@ import sys
|
||||
from migrate.versioning.shell import main as migrate_main
|
||||
|
||||
from galaxy.util.path import get_ext
|
||||
from galaxy.util.properties import find_config_file, get_data_dir, load_app_properties, running_from_source
|
||||
from galaxy.util.properties import find_config_file, get_data_dir, load_app_properties
|
||||
from galaxy.util.script import populate_config_args
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
import logging
|
||||
import os
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
SPECIAL_TOOLS = {
|
||||
|
||||
@@ -968,7 +968,7 @@ class GalaxyWebTransaction(base.DefaultWebTransaction,
|
||||
|
||||
|
||||
def default_url_path(path):
|
||||
return os.path.abspath(os.path.join(os.path.dirname( __file__ ), path))
|
||||
return os.path.abspath(os.path.join(os.path.dirname(__file__), path))
|
||||
|
||||
|
||||
def build_native_uwsgi_app(paste_factory, config_section):
|
||||
|
||||
@@ -57,7 +57,7 @@ def verify_tools(app, url, galaxy_config_file=None, engine_options={}):
|
||||
if tool_shed_accessible:
|
||||
# Automatically update the value of the migrate_tools.version database table column.
|
||||
# FIXME: this doesn't seem right.
|
||||
manage_tools = os.path.abspath(os.path.join(os.path.dirname( __file__ ), 'scripts', 'manage_tools.py'))
|
||||
manage_tools = os.path.abspath(os.path.join(os.path.dirname(__file__), 'scripts', 'manage_tools.py'))
|
||||
cmd = [executable, manage_tools, 'upgrade', 'tools']
|
||||
if galaxy_config_file:
|
||||
cmd[2:2] = ['-c', galaxy_config_file]
|
||||
|
||||
@@ -3,7 +3,6 @@ Manage automatic installation of tools configured in the xxx.xml files in ~/scri
|
||||
All of the tools were at some point included in the Galaxy distribution, but are now hosted in the main Galaxy tool shed.
|
||||
"""
|
||||
import errno
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
@@ -72,7 +71,7 @@ class ToolMigrationManager(object):
|
||||
except (IOError, OSError) as exc:
|
||||
if exc.errno == errno.ENOENT:
|
||||
with open(migrated_tools_config, 'w') as fh:
|
||||
fh.write( MIGRATED_TOOLS_CONF_XML.format(shed_tools_dir=self.app.config.shed_tools_dir))
|
||||
fh.write(MIGRATED_TOOLS_CONF_XML.format(shed_tools_dir=self.app.config.shed_tools_dir))
|
||||
tree, error_message = xml_util.parse_xml(migrated_tools_config)
|
||||
else:
|
||||
raise
|
||||
|
||||
@@ -15,7 +15,7 @@ log = logging.getLogger(__name__)
|
||||
REPOSITORY_OWNER = 'devteam'
|
||||
TOOL_MIGRATION_SCRIPTS_DIR = os.path.abspath(os.path.join(
|
||||
os.path.dirname(__file__), os.pardir, 'galaxy_install', 'migrate', 'scripts'))
|
||||
TOOL_MIGRATION_VERSIONS_DIR = os.path.abspath( os.path.join(
|
||||
TOOL_MIGRATION_VERSIONS_DIR = os.path.abspath(os.path.join(
|
||||
os.path.dirname(__file__), os.pardir, 'galaxy_install', 'migrate', 'versions'))
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ def accumulate_tool_dependencies(tool_shed_accessible, tool_dependencies, all_to
|
||||
|
||||
def check_for_missing_tools(app, tool_panel_configs, latest_tool_migration_script_number):
|
||||
# Get the 000x_tools.xml file associated with the current migrate_tools version number.
|
||||
tools_xml_file_path = os.path.abspath(os.path.join(os.path.dirname( __file__ ),
|
||||
tools_xml_file_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
||||
os.pardir, 'galaxy_install',
|
||||
'migrate', 'scripts',
|
||||
'%04d_tools.xml' % latest_tool_migration_script_number))
|
||||
|
||||
Reference in New Issue
Block a user