Skip to content

Commit 8f4333b

Browse files
committed
Flake8 fixes and variables to snake-case
1 parent 09e9eac commit 8f4333b

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

wes_client/util.py

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
import os
22
import json
3-
import glob
4-
import requests
5-
import urllib
6-
import logging
73
import schema_salad.ref_resolver
8-
from wes_service.util import visit
94
import subprocess
105
import yaml
116
import glob
127
import requests
138
import urllib
149
import logging
15-
import schema_salad.ref_resolver
1610

1711
from wes_service.util import visit
1812
from urllib import urlopen
1913

20-
def _twoSevenCompatible(filePath):
14+
15+
def _two_seven_compatible(filePath):
2116
"""Determines if a python file is 2.7 compatible by seeing if it compiles in a subprocess"""
2217
try:
2318
passes = not subprocess.call(['python2', '-m', 'py_compile', filePath])
@@ -26,9 +21,9 @@ def _twoSevenCompatible(filePath):
2621
return passes
2722

2823

29-
def _getVersion(extension, workflow_file):
24+
def _get_version(extension, workflow_file):
3025
'''Determines the version of a .py, .wdl, or .cwl file.'''
31-
if extension == 'py' and _twoSevenCompatible(workflow_file):
26+
if extension == 'py' and _two_seven_compatible(workflow_file):
3227
return '2.7'
3328
elif extension == 'cwl':
3429
return yaml.load(open(workflow_file))['cwlVersion']
@@ -49,26 +44,26 @@ def wf_info(workflow_path):
4944
enable our approach to version checking, then removed after version is extracted.
5045
"""
5146

52-
supportedFormats = ['py', 'wdl', 'cwl']
53-
fileType = workflow_path.lower().split('.')[-1] # Grab the file extension
47+
supported_formats = ['py', 'wdl', 'cwl']
48+
file_type = workflow_path.lower().split('.')[-1] # Grab the file extension
5449
workflow_path = workflow_path if ':' in workflow_path else 'file://' + workflow_path
5550

56-
if fileType in supportedFormats:
51+
if file_type in supported_formats:
5752
if workflow_path.startswith('file://'):
58-
version = _getVersion(fileType, workflow_path[7:])
53+
version = _get_version(file_type, workflow_path[7:])
5954
elif workflow_path.startswith('https://') or workflow_path.startswith('http://'):
6055
# If file not local go fetch it.
6156
html = urlopen(workflow_path).read()
62-
localLoc = os.path.join(os.getcwd(), 'fetchedFromRemote.' + fileType)
63-
with open(localLoc, 'w') as f:
57+
local_loc = os.path.join(os.getcwd(), 'fetchedFromRemote.' + file_type)
58+
with open(local_loc, 'w') as f:
6459
f.write(html)
65-
version = wf_info('file://' + localLoc)[0] # Don't take the fileType here, found it above.
66-
os.remove(localLoc) # TODO: Find a way to avoid recreating file before version determination.
60+
version = wf_info('file://' + local_loc)[0] # Don't take the file_type here, found it above.
61+
os.remove(local_loc) # TODO: Find a way to avoid recreating file before version determination.
6762
else:
6863
raise NotImplementedError('Unsupported workflow file location: {}. Must be local or HTTP(S).'.format(workflow_path))
6964
else:
70-
raise TypeError('Unsupported workflow type: .{}. Must be {}.'.format(fileType, '.py, .cwl, or .wdl'))
71-
return version, fileType.upper()
65+
raise TypeError('Unsupported workflow type: .{}. Must be {}.'.format(file_type, '.py, .cwl, or .wdl'))
66+
return version, file_type.upper()
7267

7368

7469
def build_wes_request(workflow_file, json_path, attachments=None):

0 commit comments

Comments
 (0)