Skip to content

Commit

Permalink
Merge pull request #46 from materials-data-facility/forge-dev
Browse files Browse the repository at this point in the history
Forge dev
  • Loading branch information
jgaff committed Oct 4, 2019
2 parents d10b103 + c8e88fc commit c5431b2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 20 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -2,6 +2,7 @@ language: python
python:
- '3.5'
- '3.6'
- '3.7'
install:
- pip install --upgrade pip
- pip install -e .
Expand Down
16 changes: 2 additions & 14 deletions mdf_forge/forge.py
@@ -1,4 +1,3 @@
import json
import os
import re
from urllib.parse import urlparse
Expand Down Expand Up @@ -955,7 +954,7 @@ def describe_field(self, resource_type, field=None, raw=False):
if error is not None:
print(error)
else:
mdf_toolbox.print_jsonschema(schema)
[print(line) for line in mdf_toolbox.prettify_jsonschema(schema)]
return

def describe_organization(self, organization, summary=False, raw=False):
Expand Down Expand Up @@ -1036,16 +1035,5 @@ def describe_organization(self, organization, summary=False, raw=False):
if not org.get("parent_organizations"):
org.pop("parent_organizations", None)

# Print dict as key: value
# All values besides "services" are max single-depth containers
for k, v in org.items():
if not v:
v = "None"
# "services", just prettyprint the dict
if isinstance(v, dict):
print("\t{}: {}".format(k, json.dumps(v, indent=4)))
elif isinstance(v, list):
print("\t{}: {}".format(k, ", ".join([(x or "None") for x in v])))
else:
print("\t{}: {}".format(k, str(v)))
[print(line) for line in mdf_toolbox.prettify_json(org)]
return
4 changes: 2 additions & 2 deletions setup.py
Expand Up @@ -2,15 +2,15 @@

setup(
name='mdf_forge',
version='0.7.3',
version='0.7.4',
packages=['mdf_forge'],
description='Materials Data Facility python package',
long_description=("Forge is the Materials Data Facility Python package"
" to interface and leverage the MDF Data Discovery service. "
"Forge allows users to perform simple queries and "
"facilitiates moving and synthesizing results."),
install_requires=[
"mdf-toolbox>=0.4.7",
"mdf-toolbox>=0.4.10",
"globus-sdk>=1.7.0",
"requests>=2.18.4",
"tqdm>=4.19.4"
Expand Down
8 changes: 4 additions & 4 deletions tests/test_forge.py
Expand Up @@ -668,8 +668,8 @@ def test_describe_organization(capsys):
f.describe_organization("CHiMaD")
out, err = capsys.readouterr()
assert "canonical_name: Center for Hierarchical Materials Design" in out
assert "aliases: CHiMaD" in out
assert "permission_groups: public" in out
assert "CHiMaD" in out
assert "public" in out
# List
f.describe_organization("list")
out, err = capsys.readouterr()
Expand All @@ -682,8 +682,8 @@ def test_describe_organization(capsys):
out, err = capsys.readouterr()
assert "canonical_name: Center for Hierarchical Materials Design" not in out
assert "Center for Hierarchical Materials Design" in out
assert "aliases: CHiMaD" in out
assert "permission_groups: public" not in out
assert "CHiMaD" in out
assert "public" not in out

# Errors
# Invalid org
Expand Down
Binary file modified travis.tar.enc
Binary file not shown.

0 comments on commit c5431b2

Please sign in to comment.