Skip to content

Commit

Permalink
cherry-pick merge upstream/develop/39f79eb
Browse files Browse the repository at this point in the history
  • Loading branch information
i-am-sijia committed Apr 15, 2021
1 parent 26bea18 commit d8e37e5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lasso/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,13 +375,12 @@ def read_logfile(logfilename: Union[str, List[str]]) -> DataFrame:
]
WranglerLogger.debug("Link Cols: {}".format(_linkcol))

_node_df = pd.DataFrame(
[x.split(",") for x in _node_lines[1:]], columns=_nodecol
)
def split_log(x):
return list(reader([x], delimiter=',', quotechar='"'))[0]

_node_df = pd.DataFrame([split_log(x) for x in _node_lines[1:]],columns = _nodecol)
WranglerLogger.debug("Node DF: {}".format(_node_df))
_link_df = pd.DataFrame(
[x.split(",") for x in _link_lines[1:]], columns=_linkcol
)
_link_df = pd.DataFrame([split_log(x) for x in _link_lines[1:]],columns = _linkcol)
WranglerLogger.debug("Link DF: {}".format(_link_df))

node_df = pd.concat([node_df, _node_df])
Expand Down Expand Up @@ -561,7 +560,7 @@ def _process_link_additions(
""""""
WranglerLogger.debug("Processing link additions")
cube_add_df = link_changes_df[link_changes_df.OPERATION_final == "A"]
if not cube_add_df.shape[1]:
if len(cube_add_df) == 0:
WranglerLogger.debug("No link additions processed")
return {}

Expand All @@ -588,7 +587,7 @@ def _process_node_additions(node_add_df):
""""""
WranglerLogger.debug("Processing node additions")

if not node_add_df.shape[1]:
if len(node_add_df) == 0:
WranglerLogger.debug("No node additions processed")
return []

Expand Down Expand Up @@ -630,7 +629,7 @@ def _process_single_link_change(change_row, changeable_col):
for col in changeable_col:
WranglerLogger.debug("Assessing Column: {}".format(col))
# if it is the same as before, or a static value, don't process as a change
if str(change_row[col]) == str(base_row[col]):
if str(change_row[col]).strip('"\'') == str(base_row[col]).strip('"\''):
continue
if (col == "roadway_class") & (change_row[col] == 0):
continue
Expand Down Expand Up @@ -814,7 +813,8 @@ def _consolidate_actions(log, base, key_list):
add_link_dict = _process_link_additions(
link_changes_df, limit_variables_to_existing_network
)
add_link_dict["nodes"] = _process_node_additions(node_add_df)
if len(_process_node_additions(node_add_df)):
add_link_dict["nodes"] = _process_node_additions(node_add_df)

# process changes
WranglerLogger.debug("Processing changes")
Expand Down

0 comments on commit d8e37e5

Please sign in to comment.