Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wshayes committed Oct 12, 2018
1 parent 5785c4e commit 809c6b2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
2 changes: 0 additions & 2 deletions bel/lang/bel_specification.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ def get_specification(version: str) -> Mapping[str, Any]:
"""

spec_dir = config['bel']['lang']['specifications']

spec_dict = {}

bel_versions = get_bel_versions()
Expand Down Expand Up @@ -196,7 +195,6 @@ def update_specifications(force: bool = False):
def github_belspec_files(spec_dir, force: bool = False):
"""Get belspec files from Github repo
Repo: https://github.com/belbio/bel_specifications/tree/master/specifications
Args:
spec_dir: directory to store the BEL Specification and derived files
Expand Down
1 change: 1 addition & 0 deletions bel/lang/belobj.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def __init__(self, version: str = None, api_url: str = None) -> None:
# use importlib to import our parser (a .py file) and set the BELParse object as an instance variable
try:
parser_fn = self.spec['admin']['parser_fn']

parser_name = os.path.basename(parser_fn).replace('.py', '')
module_spec = importlib.util.spec_from_file_location(parser_name, parser_fn)
imported_parser = importlib.util.module_from_spec(module_spec)
Expand Down
10 changes: 2 additions & 8 deletions bel/lang/semantics.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ def validate_arg_values(ast, bo):
request_url = bo.api_url + '/terms/{}'.format(url_path_param_quoting(term_id))
log.info(f'Validate Arg Values url {request_url}')
r = get_url(request_url)

if r and r.status_code == 200:
result = r.json()
# function signature term value_types doesn't match up with API term entity_types
Expand All @@ -254,13 +253,8 @@ def validate_arg_values(ast, bo):
# Term is valid
else:
log.debug('Valid Term: {}'.format(term_id))
elif r and r.status_code == 404:
msg = r.json()
if msg.get('title', None) == 'No Term':
log.debug(f"No term found for /terms/{term_id}")
bo.validation_messages.append(('WARNING', f'Term: {term_id} not found'))
else:
log.error(f'Status 404 - Bad URL: {request_url}')
elif r.status_code == 404:
bo.validation_messages.append(('WARNING', f'Term: {term_id} not found in namespace'))
else:
log.error(f'Status {r.status_code} - Bad URL: {request_url}')

Expand Down
4 changes: 2 additions & 2 deletions bel/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_url(url: str, params: dict = None, timeout: float = 5.0, cache: bool = T

timespan = datetime.datetime.now() - start
timespan_ms = timespan.total_seconds() * 1000 # converted to milliseconds
log.info(f'GET url success', cache_allowed=cache, timespan_ms=timespan_ms, url=url, params=params)
# log.debug(f'GET url success', cache_allowed=cache, timespan_ms=timespan_ms, url=url, params=params)

return r

Expand Down Expand Up @@ -87,7 +87,7 @@ def download_file(url):
if chunk: # filter out keep-alive new chunks
fp.write(chunk)

log.info(f'Download file - tmp file: {fp.name} size: {fp.tell()}')
# log.info(f'Download file - tmp file: {fp.name} size: {fp.tell()}')
return fp


Expand Down

0 comments on commit 809c6b2

Please sign in to comment.