Conversation
hatchet/graphframe.py
Outdated
| self.inc_metrics = [] if inc_metrics is None else inc_metrics | ||
|
|
||
| @staticmethod | ||
| def from_path(dirname_or_data, query, profile_format=None): |
There was a problem hiding this comment.
query should have a default to empty string
| query (str): | ||
| profile_format (str): Override for the profile_format, if detection | ||
| of format fails. | ||
| """ |
There was a problem hiding this comment.
assertions for input types
hatchet/graphframe.py
Outdated
| 'lists': GraphFrame.from_lists(dirname_or_data), | ||
| } | ||
|
|
||
| if profile_format: |
There was a problem hiding this comment.
if profile_format is not None
note that your condition will work, but i dont like using it. by explicitly writing is not None you tell the rreader what you want and also catch the case wherre i pass profilee_format=True (a bool)
hatchet/graphframe.py
Outdated
|
|
||
| profile_format = GraphFrame._detect_profile_format(dirname_or_data) | ||
|
|
||
| if query: |
hatchet/graphframe.py
Outdated
| } | ||
|
|
||
| # Determine dirname_or_data is a str and a path exists | ||
| if type(dirname_or_data) == 'str' and os.path.exists(os.path.dirname(dirname_or_data)): |
There was a problem hiding this comment.
not sure what the purpose of the secnd condition is
hatchet/graphframe.py
Outdated
|
|
||
|
|
||
| # check if it is a file | ||
| elif os.path.isfile(dirname_or_data): |
There was a problem hiding this comment.
in principle, you dnt need elif.. just if
| return 'pstats' | ||
| elif _file_ext == 'json': | ||
| # TODO: Check if we can just load the key and dtype of JSON. | ||
| # We could also be unnecessarily read the data again. |
There was a problem hiding this comment.
good comment. agreed. ask abhinav how he wants to handle this
hatchet/graphframe.py
Outdated
| return 'timemory' | ||
| elif _file_ext == "dot": | ||
| return 'grpof' | ||
| elif type(dirname_or_data) == 'list': |
There was a problem hiding this comment.
i generally like to put simpler case at thee top.. thiis function wont be call many times so there is no performance hit. otherwise, you'd want to put more frequent cases first.
No description provided.