Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
natefoo committed Sep 21, 2015
1 parent 97ad53f commit 975fdde
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 16 deletions.
1 change: 0 additions & 1 deletion lib/galaxy/datatypes/binary.py
Expand Up @@ -8,7 +8,6 @@
import struct
import subprocess
import tempfile
import warnings
import zipfile

from bx.seq.twobit import TWOBIT_MAGIC_NUMBER, TWOBIT_MAGIC_NUMBER_SWAP, TWOBIT_MAGIC_SIZE
Expand Down
1 change: 0 additions & 1 deletion lib/galaxy/datatypes/converters/vcf_to_vcf_bgzip.py
Expand Up @@ -7,7 +7,6 @@
usage: %prog in_file out_file
"""
import pkg_resources
import ctabix
import optparse

Expand Down
1 change: 0 additions & 1 deletion lib/galaxy/model/orm/scripts.py
Expand Up @@ -6,7 +6,6 @@

from galaxy.util.properties import load_app_properties

import pkg_resources

log = logging.getLogger( __name__ )

Expand Down
1 change: 0 additions & 1 deletion lib/galaxy/queue_worker.py
Expand Up @@ -5,7 +5,6 @@

import logging
import threading
import sys

import galaxy.queues
from galaxy import util
Expand Down
2 changes: 0 additions & 2 deletions lib/galaxy/queues.py
Expand Up @@ -4,8 +4,6 @@
"""

import sys

from galaxy.config import process_is_uwsgi

from kombu import Exchange, Queue, Connection
Expand Down
16 changes: 8 additions & 8 deletions lib/galaxy/wheels.py
Expand Up @@ -30,14 +30,14 @@ def check( self, name ):
return True
else:
try:
return { "psycopg2": lambda: self.config.get( "app:main", "database_connection" ).startswith( "postgres" ),
"MySQL_python": lambda: self.config.get( "app:main", "database_connection" ).startswith( "mysql://" ),
"DRMAA_python": lambda: "sge" in self.config.get( "app:main", "start_job_runners" ).split(","),
"drmaa": lambda: "drmaa" in self.config.get( "app:main", "start_job_runners" ).split(","),
"pbs_python": lambda: "pbs" in self.config.get( "app:main", "start_job_runners" ).split(","),
"python_openid": lambda: self.config.get( "app:main", "enable_openid" ),
"python_daemon": lambda: sys.version_info[:2] >= ( 2, 5 ),
"PyRods": lambda: self.config.get( "app:main", "object_store" ) == "irods"
return { "psycopg2": lambda: self.config.get( "app:main", "database_connection" ).startswith( "postgres" ),
"MySQL_python": lambda: self.config.get( "app:main", "database_connection" ).startswith( "mysql://" ),
"DRMAA_python": lambda: "sge" in self.config.get( "app:main", "start_job_runners" ).split(","),
"drmaa": lambda: "drmaa" in self.config.get( "app:main", "start_job_runners" ).split(","),
"pbs_python": lambda: "pbs" in self.config.get( "app:main", "start_job_runners" ).split(","),
"python_openid": lambda: self.config.get( "app:main", "enable_openid" ),
"python_daemon": lambda: sys.version_info[:2] >= ( 2, 5 ),
"PyRods": lambda: self.config.get( "app:main", "object_store" ) == "irods"
}.get( name, lambda: True )()
except:
return False
Expand Down
13 changes: 12 additions & 1 deletion lib/pulsar/client/transport/poster.py
Expand Up @@ -11,7 +11,12 @@
except ImportError:
from urllib.request import Request

import poster
try:
import poster
except ImportError:
poster = None

POSTER_UNAVAILABLE_MESSAGE = "Pulsar configured to use poster module - but it is unavailable. Please install poster."

log = logging.getLogger(__name__)

Expand All @@ -21,6 +26,7 @@


def post_file(url, path):
__ensure_poster()
try:
datagen, headers = poster.encode.multipart_encode({"file": open(path, "rb")})
request = Request(url, datagen, headers)
Expand All @@ -40,3 +46,8 @@ def get_file(url, path):
if not buffer:
break
output.write(buffer)


def __ensure_poster():
if poster is None:
raise ImportError(POSTER_UNAVAILABLE_MESSAGE)
12 changes: 11 additions & 1 deletion lib/pulsar/client/transport/requests.py
Expand Up @@ -2,7 +2,10 @@

import logging

import requests
try:
import requests
except ImportError:
requests = None

try:
import requests_toolbelt
Expand All @@ -12,6 +15,7 @@
requests_toolbelt = None


REQUESTS_UNAVAILABLE_MESSAGE = "Pulsar configured to use requests module - but it is unavailable. Please install requests."
REQUESTS_TOOLBELT_UNAVAILABLE_MESSAGE = "Pulsar configured to use requests_toolbelt module - but it is unavailable. Please install requests_toolbelt."

log = logging.getLogger(__name__)
Expand All @@ -21,6 +25,7 @@ def post_file(url, path):
if requests_toolbelt is None:
raise ImportError(REQUESTS_TOOLBELT_UNAVAILABLE_MESSAGE)

__ensure_requests()
m = requests_toolbelt.MultipartEncoder(
fields={'file': ('filename', open(path, 'rb'))}
)
Expand All @@ -35,3 +40,8 @@ def get_file(url, path):
if chunk: # filter out keep-alive new chunks
f.write(chunk)
f.flush()


def __ensure_requests():
if requests is None:
raise ImportError(REQUESTS_UNAVAILABLE_MESSAGE)

0 comments on commit 975fdde

Please sign in to comment.