Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Raalsky committed Sep 27, 2022
1 parent 99dbe99 commit ec31dc9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions neptune/new/internal/utils/source_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@


def upload_source_code(source_files: Optional[List[str]], run: "Run") -> None:
entry_file = get_path_executed_script()
entry_filepath = get_path_executed_script()

if not is_ipython() and entry_file != empty_path and os.path.isfile(entry_file):
if not is_ipython() and entry_filepath != empty_path and os.path.isfile(entry_filepath):
if source_files is None:
entrypoint = os.path.basename(entry_file)
source_files = str(entry_file)
entrypoint = os.path.basename(entry_filepath)
source_files = str(entry_filepath)
elif not source_files:
entrypoint = os.path.basename(entry_file)
entrypoint = os.path.basename(entry_filepath)
else:
common_root = get_common_root(get_absolute_paths(source_files))
if common_root is not None:
entrypoint = normalize_file_name(
os.path.relpath(os.path.abspath(entry_file), common_root)
os.path.relpath(os.path.abspath(entry_filepath), common_root)
)
else:
entrypoint = normalize_file_name(os.path.abspath(entry_file))
entrypoint = normalize_file_name(os.path.abspath(entry_filepath))
run[attr_consts.SOURCE_CODE_ENTRYPOINT_ATTRIBUTE_PATH] = entrypoint

if source_files is not None:
Expand Down

0 comments on commit ec31dc9

Please sign in to comment.