Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

Commit

Permalink
Merge pull request #168 from multinet-app/add_pep8_naming
Browse files Browse the repository at this point in the history
Add flake8 plugin for pep8 naming
  • Loading branch information
jjnesbitt committed Aug 27, 2019
2 parents bcf6da5 + 8e08642 commit c8fa598
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pytest-cov = "==2.7.1"
pytest-xdist = "==1.29.0"
recommonmark = "==0.5.0"
pre-commit = "==1.18.2"
pep8-naming = "*"

[requires]
python_version = "3.7"
Expand Down
16 changes: 12 additions & 4 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions multinet/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ def create_graph(workspace, graph, node_tables=None, edge_table=None):
if missing:
raise RequiredParamsMissing(missing)

loadedWorkspace = db.db(workspace)
if loadedWorkspace.has_graph(graph):
loaded_workspace = db.db(workspace)
if loaded_workspace.has_graph(graph):
raise AlreadyExists("Graph", graph)

existing_tables = set([x["name"] for x in loadedWorkspace.collections()])
edges = loadedWorkspace.collection(edge_table).all()
existing_tables = set([x["name"] for x in loaded_workspace.collections()])
edges = loaded_workspace.collection(edge_table).all()

# Iterate through each edge and check for undefined tables
errors = []
Expand All @@ -153,7 +153,7 @@ def create_graph(workspace, graph, node_tables=None, edge_table=None):
# Iterate through each node table and check for nonexistent keys
for table in valid_tables:
existing_keys = set(
[x["_key"] for x in loadedWorkspace.collection(table).all()]
[x["_key"] for x in loaded_workspace.collection(table).all()]
)
nonexistent_keys = valid_tables[table] - existing_keys

Expand Down
6 changes: 3 additions & 3 deletions multinet/uploaders/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ def validate_csv(rows):
if "_key" in fieldnames:
# Node Table, check for key uniqueness
keys = [row["_key"] for row in rows]
uniqueKeys = set()
unique_keys = set()
duplicates = set()
for key in keys:
if key in uniqueKeys:
if key in unique_keys:
duplicates.add(key)
else:
uniqueKeys.add(key)
unique_keys.add(key)

if len(duplicates) > 0:
return {"error": "duplicate", "detail": list(duplicates)}
Expand Down

0 comments on commit c8fa598

Please sign in to comment.