project_name
string
class_name
string
class_modifiers
string
class_implements
int64
class_extends
int64
function_name
string
function_body
string
cyclomatic_complexity
int64
NLOC
int64
num_parameter
int64
num_token
int64
num_variable
int64
start_line
int64
end_line
int64
function_index
int64
function_params
string
function_variable
string
function_return_type
string
function_body_line_type
string
function_num_functions
int64
function_num_lines
int64
outgoing_function_count
int64
outgoing_function_names
string
incoming_function_count
int64
incoming_function_names
string
lexical_representation
string
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
_get_hashed_file_name_from_root_str
def _get_hashed_file_name_from_root_str(manifest: BaseAssetManifest,source_root: str,manifest_name_suffix: str,) -> tuple[HashAlgorithm, str]:"""Gathers metadata information of manifest to be used for writing the local manifest"""hash_alg = manifest.get_default_hash_alg()manifest_name_prefix = hash_data(source_root.encode(), hash_alg)manifest_name = f"{manifest_name_prefix}_{manifest_name_suffix}"return (hash_alg, manifest_name)
1
9
3
53
0
335
347
335
manifest,source_root,manifest_name_suffix
[]
tuple[HashAlgorithm, str]
{"Assign": 3, "Expr": 1, "Return": 1}
3
13
3
["manifest.get_default_hash_alg", "hash_data", "source_root.encode"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync._check_and_write_local_manifests", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.test_upload_py.TestUpload.test_get_hashed_file_name_from_root_str"]
The function (_get_hashed_file_name_from_root_str) defined within the public class called S3AssetUploader.The function start at line 335 and ends at 347. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [335.0] and does not return any value. It declares 3.0 functions, It has 3.0 functions called inside which are ["manifest.get_default_hash_alg", "hash_data", "source_root.encode"], It has 2.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync._check_and_write_local_manifests", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.test_upload_py.TestUpload.test_get_hashed_file_name_from_root_str"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
_write_local_input_manifest
def _write_local_input_manifest(manifest_write_dir: str,manifest_name: str,manifest: BaseAssetManifest,root_dir_name: Optional[str] = None,) -> Path:"""Creates 'manifests' sub-directory and writes a local input manifest file"""input_manifest_folder_name = "manifests"if root_dir_name is not None:input_manifest_folder_name = root_dir_name + "_" + input_manifest_folder_namelocal_manifest_file = Path(manifest_write_dir, input_manifest_folder_name, manifest_name)logger.debug(f"Creating local manifest file: {local_manifest_file}")local_manifest_file.parent.mkdir(parents=True, exist_ok=True)with open(local_manifest_file, "w") as file:file.write(manifest.encode())return local_manifest_file
2
15
4
97
0
350
369
350
manifest_write_dir,manifest_name,manifest,root_dir_name
[]
Path
{"Assign": 3, "Expr": 4, "If": 1, "Return": 1, "With": 1}
6
20
6
["Path", "logger.debug", "local_manifest_file.parent.mkdir", "open", "file.write", "manifest.encode"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync._check_and_write_local_manifests"]
The function (_write_local_input_manifest) defined within the public class called S3AssetUploader.The function start at line 350 and ends at 369. It contains 15 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [350.0] and does not return any value. It declares 6.0 functions, It has 6.0 functions called inside which are ["Path", "logger.debug", "local_manifest_file.parent.mkdir", "open", "file.write", "manifest.encode"], It has 1.0 function calling this function which is ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync._check_and_write_local_manifests"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
_write_local_manifest_s3_mapping
def _write_local_manifest_s3_mapping(self,manifest_write_dir: str,manifest_name: str,full_manifest_key: str,manifest_dir_name: Optional[str] = None,):"""Create or append to an existing mapping file. We use this since path lengths can go beyond thefile name length limit on Windows if we were to create the full S3 key path locally."""manifest_map_file = Path(manifest_write_dir, manifest_dir_name or "manifests", "manifest_s3_mapping")mapping = {"local_file": manifest_name, "s3_key": full_manifest_key}with open(manifest_map_file, "a") as mapping_file:mapping_file.write(f"{mapping}\n")
2
13
5
68
0
371
387
371
self,manifest_write_dir,manifest_name,full_manifest_key,manifest_dir_name
[]
None
{"Assign": 2, "Expr": 2, "With": 1}
3
17
3
["Path", "open", "mapping_file.write"]
0
[]
The function (_write_local_manifest_s3_mapping) defined within the public class called S3AssetUploader.The function start at line 371 and ends at 387. It contains 13 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [371.0] and does not return any value. It declares 3.0 functions, and It has 3.0 functions called inside which are ["Path", "open", "mapping_file.write"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
upload_input_files
def upload_input_files(self,manifest: BaseAssetManifest,s3_bucket: str,source_root: Path,s3_cas_prefix: str,progress_tracker: Optional[ProgressTracker] = None,s3_check_cache_dir: Optional[str] = None,) -> None:"""Uploads all of the files listed in the given manifest to S3 if they don't exist in thegiven S3 prefix already.The local 'S3 check cache' is used to note if we've seen an object in S3 before so wecan save the S3 API calls."""# Split into a separate 'large file' and 'small file' queues.# Separate 'large' files from 'small' files so that we can process 'large' files serially.# This wastes less bandwidth if uploads are cancelled, as it's better to use the multi-threaded# multi-part upload for a single large file than multiple large files at the same time.(small_file_queue, large_file_queue) = self._separate_files_by_size(manifest.paths, self.small_file_threshold)with S3CheckCache(s3_check_cache_dir) as s3_cache:# First, process the whole 'small file' queue with parallel object uploads.with concurrent.futures.ThreadPoolExecutor(max_workers=self.num_upload_workers) as executor:futures = {executor.submit(self.upload_object_to_cas,file,manifest.hashAlg,s3_bucket,source_root,s3_cas_prefix,s3_cache,progress_tracker,): filefor file in small_file_queue}# surfaces any exceptions in the threadfor future in concurrent.futures.as_completed(futures):(is_uploaded, file_size) = future.result()if progress_tracker and not is_uploaded:progress_tracker.increase_skipped(1, file_size)# Now process the whole 'large file' queue with serial object uploads (but still parallel multi-part upload.)for file in large_file_queue:(is_uploaded, file_size) = self.upload_object_to_cas(file,manifest.hashAlg,s3_bucket,source_root,s3_cas_prefix,s3_cache,progress_tracker,)if progress_tracker and not is_uploaded:progress_tracker.increase_skipped(1, file_size)# to report progress 100% at the end, and# to check if the job submission was canceled in the middle of processing the last batch of files.if progress_tracker:progress_tracker.report_progress()if not progress_tracker.continue_reporting:raise AssetSyncCancelledError("File upload cancelled.", progress_tracker.get_summary_statistics())
10
51
7
228
0
389
459
389
self,manifest,s3_bucket,source_root,s3_cas_prefix,progress_tracker,s3_check_cache_dir
[]
None
{"Assign": 4, "Expr": 4, "For": 2, "If": 4, "With": 2}
12
71
12
["self._separate_files_by_size", "S3CheckCache", "concurrent.futures.ThreadPoolExecutor", "executor.submit", "concurrent.futures.as_completed", "future.result", "progress_tracker.increase_skipped", "self.upload_object_to_cas", "progress_tracker.increase_skipped", "progress_tracker.report_progress", "AssetSyncCancelledError", "progress_tracker.get_summary_statistics"]
0
[]
The function (upload_input_files) defined within the public class called S3AssetUploader.The function start at line 389 and ends at 459. It contains 51 lines of code and it has a cyclomatic complexity of 10. It takes 7 parameters, represented as [389.0] and does not return any value. It declares 12.0 functions, and It has 12.0 functions called inside which are ["self._separate_files_by_size", "S3CheckCache", "concurrent.futures.ThreadPoolExecutor", "executor.submit", "concurrent.futures.as_completed", "future.result", "progress_tracker.increase_skipped", "self.upload_object_to_cas", "progress_tracker.increase_skipped", "progress_tracker.report_progress", "AssetSyncCancelledError", "progress_tracker.get_summary_statistics"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
_snapshot_input_files
def _snapshot_input_files(self,snapshot_dir: Path,manifest: BaseAssetManifest,source_root: Path,progress_tracker: Optional[ProgressTracker] = None,) -> None:"""Snapshots all of the files listed in the given manifest to snapshot_dir."""os.makedirs(snapshot_dir / S3_DATA_FOLDER_NAME, exist_ok=True)# Process all the paths with parallel copy calls.with concurrent.futures.ThreadPoolExecutor(max_workers=self.num_upload_workers) as executor:futures = {executor.submit(self._snapshot_object_to_cas,file,manifest.hashAlg,snapshot_dir,source_root,progress_tracker,): filefor file in manifest.paths}# surfaces any exceptions in the threadfor future in concurrent.futures.as_completed(futures):future.result()# to report progress 100% at the end, and# to check if the job snapshot was canceled in the middle of processing the last batch of files.if progress_tracker:progress_tracker.report_progress()if not progress_tracker.continue_reporting:raise AssetSyncCancelledError("File snapshot cancelled.", progress_tracker.get_summary_statistics())
5
28
5
133
0
461
497
461
self,snapshot_dir,manifest,source_root,progress_tracker
[]
None
{"Assign": 1, "Expr": 4, "For": 1, "If": 2, "With": 1}
8
37
8
["os.makedirs", "concurrent.futures.ThreadPoolExecutor", "executor.submit", "concurrent.futures.as_completed", "future.result", "progress_tracker.report_progress", "AssetSyncCancelledError", "progress_tracker.get_summary_statistics"]
0
[]
The function (_snapshot_input_files) defined within the public class called S3AssetUploader.The function start at line 461 and ends at 497. It contains 28 lines of code and it has a cyclomatic complexity of 5. It takes 5 parameters, represented as [461.0] and does not return any value. It declares 8.0 functions, and It has 8.0 functions called inside which are ["os.makedirs", "concurrent.futures.ThreadPoolExecutor", "executor.submit", "concurrent.futures.as_completed", "future.result", "progress_tracker.report_progress", "AssetSyncCancelledError", "progress_tracker.get_summary_statistics"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
reset_s3_check_cache
def reset_s3_check_cache(self, s3_check_cache_dir: Optional[str]) -> None:"""Resets the S3 check cache by removing the cache altogether."""with S3CheckCache(s3_check_cache_dir) as s3_check_cache:logger.debug(f"The s3_check_cache.db file in {s3_check_cache_dir} will be deleted, "f"as a mismatch between the cache and the actual hash in S3 was found")# Remove the cache files3_check_cache.remove_cache()
1
7
2
37
0
499
509
499
self,s3_check_cache_dir
[]
None
{"Expr": 3, "With": 1}
3
11
3
["S3CheckCache", "logger.debug", "s3_check_cache.remove_cache"]
0
[]
The function (reset_s3_check_cache) defined within the public class called S3AssetUploader.The function start at line 499 and ends at 509. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [499.0] and does not return any value. It declares 3.0 functions, and It has 3.0 functions called inside which are ["S3CheckCache", "logger.debug", "s3_check_cache.remove_cache"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
_check_hashes_exist_in_s3
def _check_hashes_exist_in_s3(self, cache_entries: List[S3CheckCacheEntry]) -> bool:"""checks if the hashes in the cache entries exist in S3"""for cache_entry in cache_entries:try:# Split the S3 key into bucket and key partsbucket, key = cache_entry.s3_key.split("/", 1)# Check if the object is already uploaded and exist in S3 bucketif self.file_already_uploaded(bucket=bucket, key=key):logger.debug(f"cache_entry: {cache_entry} exist in S3")# If a mismatch found, return False to reset the cache immediately. There's no need to check the rest.else:return Falseexcept Exception as e:# If error occurs, log warning and return False to indicate cache reset requiredlogger.warning(f"Error occurred while checking {cache_entry}. Exception: {e}")return False# Otherwise all hashes exist in S3return True
4
12
2
77
0
511
533
511
self,cache_entries
[]
bool
{"Assign": 1, "Expr": 3, "For": 1, "If": 1, "Return": 3, "Try": 1}
4
23
4
["cache_entry.s3_key.split", "self.file_already_uploaded", "logger.debug", "logger.warning"]
0
[]
The function (_check_hashes_exist_in_s3) defined within the public class called S3AssetUploader.The function start at line 511 and ends at 533. It contains 12 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [511.0] and does not return any value. It declares 4.0 functions, and It has 4.0 functions called inside which are ["cache_entry.s3_key.split", "self.file_already_uploaded", "logger.debug", "logger.warning"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
verify_hash_cache_integrity
def verify_hash_cache_integrity(self,s3_check_cache_dir: Optional[str],manifest: BaseAssetManifest,s3_cas_prefix: str,s3_bucket: str,) -> bool:"""Inspects a sampling of the assets provided in manifest that are present in the S3 check cache andverifies if the cached assets exist in S3. Returns True if all sampled cached assets exist in S3, Falseotherwise."""# Find the list of s3 upload keys that have been cacheds3_upload_keys: List[str] = [self._generate_s3_upload_key(file, manifest.hashAlg, s3_cas_prefix)for file in manifest.paths]random.shuffle(s3_upload_keys)sampled_cache_entries: List[S3CheckCacheEntry] = []with S3CheckCache(s3_check_cache_dir) as s3_cache:local_connection = s3_cache.get_local_connection()for upload_key in s3_upload_keys:this_entry = s3_cache.get_connection_entry(s3_key=f"{s3_bucket}/{upload_key}", connection=local_connection)if this_entry is not None:sampled_cache_entries.append(this_entry)if len(sampled_cache_entries) >= 30:breakreturn self._check_hashes_exist_in_s3(sampled_cache_entries)
5
24
5
133
0
535
565
535
self,s3_check_cache_dir,manifest,s3_cas_prefix,s3_bucket
[]
bool
{"AnnAssign": 2, "Assign": 2, "Expr": 3, "For": 1, "If": 2, "Return": 1, "With": 1}
8
31
8
["self._generate_s3_upload_key", "random.shuffle", "S3CheckCache", "s3_cache.get_local_connection", "s3_cache.get_connection_entry", "sampled_cache_entries.append", "len", "self._check_hashes_exist_in_s3"]
0
[]
The function (verify_hash_cache_integrity) defined within the public class called S3AssetUploader.The function start at line 535 and ends at 565. It contains 24 lines of code and it has a cyclomatic complexity of 5. It takes 5 parameters, represented as [535.0] and does not return any value. It declares 8.0 functions, and It has 8.0 functions called inside which are ["self._generate_s3_upload_key", "random.shuffle", "S3CheckCache", "s3_cache.get_local_connection", "s3_cache.get_connection_entry", "sampled_cache_entries.append", "len", "self._check_hashes_exist_in_s3"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
_separate_files_by_size
def _separate_files_by_size(self,files_to_upload: list[base_manifest.BaseManifestPath],size_threshold: int,) -> Tuple[list[base_manifest.BaseManifestPath], list[base_manifest.BaseManifestPath]]:"""Splits the given list of files into two queues: one for small files and one for large files."""small_file_queue: list[base_manifest.BaseManifestPath] = []large_file_queue: list[base_manifest.BaseManifestPath] = []for file in files_to_upload:if file.size <= size_threshold:small_file_queue.append(file)else:large_file_queue.append(file)return (small_file_queue, large_file_queue)
3
13
3
91
0
567
582
567
self,files_to_upload,size_threshold
[]
Tuple[list[base_manifest.BaseManifestPath], list[base_manifest.BaseManifestPath]]
{"AnnAssign": 2, "Expr": 3, "For": 1, "If": 1, "Return": 1}
2
16
2
["small_file_queue.append", "large_file_queue.append"]
0
[]
The function (_separate_files_by_size) defined within the public class called S3AssetUploader.The function start at line 567 and ends at 582. It contains 13 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [567.0] and does not return any value. It declares 2.0 functions, and It has 2.0 functions called inside which are ["small_file_queue.append", "large_file_queue.append"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
_get_current_timestamp
def _get_current_timestamp(self) -> str:return str(datetime.now().timestamp())
1
2
1
20
0
584
585
584
self
[]
str
{"Return": 1}
3
2
3
["str", "timestamp", "datetime.now"]
0
[]
The function (_get_current_timestamp) defined within the public class called S3AssetUploader.The function start at line 584 and ends at 585. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3.0 functions called inside which are ["str", "timestamp", "datetime.now"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
_generate_s3_upload_key
def _generate_s3_upload_key(self,file: base_manifest.BaseManifestPath,hash_algorithm: HashAlgorithm,s3_cas_prefix: str,) -> str:s3_upload_key = f"{file.hash}.{hash_algorithm.value}"if s3_cas_prefix:s3_upload_key = _join_s3_paths(s3_cas_prefix, s3_upload_key)return s3_upload_key
2
10
4
39
0
587
596
587
self,file,hash_algorithm,s3_cas_prefix
[]
str
{"Assign": 2, "If": 1, "Return": 1}
1
10
1
["_join_s3_paths"]
0
[]
The function (_generate_s3_upload_key) defined within the public class called S3AssetUploader.The function start at line 587 and ends at 596. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [587.0] and does not return any value. It declare 1.0 function, and It has 1.0 function called inside which is ["_join_s3_paths"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
upload_object_to_cas
def upload_object_to_cas(self,file: base_manifest.BaseManifestPath,hash_algorithm: HashAlgorithm,s3_bucket: str,source_root: Path,s3_cas_prefix: str,s3_check_cache: S3CheckCache,progress_tracker: Optional[ProgressTracker] = None,) -> Tuple[bool, int]:"""Uploads an object to the S3 content-addressable storage (CAS) prefix. Optionally,does a head-object check and only uploads the file if it doesn't exist in S3 already.Returns a tuple (whether it has been uploaded, the file size)."""local_path = source_root.joinpath(file.path)s3_upload_key = self._generate_s3_upload_key(file, hash_algorithm, s3_cas_prefix)is_uploaded = Falseif s3_check_cache.get_connection_entry(s3_key=f"{s3_bucket}/{s3_upload_key}", connection=s3_check_cache.get_local_connection()):logger.debug(f"skipping {local_path} because {s3_bucket}/{s3_upload_key} exists in the cache")return (is_uploaded, file.size)if self.file_already_uploaded(s3_bucket, s3_upload_key):logger.debug(f"skipping {local_path} because it has already been uploaded to s3://{s3_bucket}/{s3_upload_key}")else:self.upload_file_to_s3(local_path=local_path,s3_bucket=s3_bucket,s3_upload_key=s3_upload_key,progress_tracker=progress_tracker,)is_uploaded = Trues3_check_cache.put_entry(S3CheckCacheEntry(s3_key=f"{s3_bucket}/{s3_upload_key}",last_seen_time=self._get_current_timestamp(),))return (is_uploaded, file.size)
3
39
8
180
0
598
645
598
self,file,hash_algorithm,s3_bucket,source_root,s3_cas_prefix,s3_check_cache,progress_tracker
[]
Tuple[bool, int]
{"Assign": 4, "Expr": 5, "If": 2, "Return": 2}
11
48
11
["source_root.joinpath", "self._generate_s3_upload_key", "s3_check_cache.get_connection_entry", "s3_check_cache.get_local_connection", "logger.debug", "self.file_already_uploaded", "logger.debug", "self.upload_file_to_s3", "s3_check_cache.put_entry", "S3CheckCacheEntry", "self._get_current_timestamp"]
0
[]
The function (upload_object_to_cas) defined within the public class called S3AssetUploader.The function start at line 598 and ends at 645. It contains 39 lines of code and it has a cyclomatic complexity of 3. It takes 8 parameters, represented as [598.0] and does not return any value. It declares 11.0 functions, and It has 11.0 functions called inside which are ["source_root.joinpath", "self._generate_s3_upload_key", "s3_check_cache.get_connection_entry", "s3_check_cache.get_local_connection", "logger.debug", "self.file_already_uploaded", "logger.debug", "self.upload_file_to_s3", "s3_check_cache.put_entry", "S3CheckCacheEntry", "self._get_current_timestamp"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
_snapshot_object_to_cas
def _snapshot_object_to_cas(self,file: base_manifest.BaseManifestPath,hash_algorithm: HashAlgorithm,snapshot_dir: Path,source_root: Path,progress_tracker: Optional[ProgressTracker] = None,):"""Snapshots an object to the snapshot directory content-addressable storage (CAS) prefix."""local_path = source_root.joinpath(file.path)s3_upload_key = self._generate_s3_upload_key(file, hash_algorithm, S3_DATA_FOLDER_NAME)file_size = local_path.resolve().stat().st_sizeshutil.copy2(local_path, snapshot_dir / s3_upload_key)if progress_tracker is not None:progress_tracker.track_progress_callback(file_size)
2
14
6
91
0
647
664
647
self,file,hash_algorithm,snapshot_dir,source_root,progress_tracker
[]
None
{"Assign": 3, "Expr": 3, "If": 1}
6
18
6
["source_root.joinpath", "self._generate_s3_upload_key", "stat", "local_path.resolve", "shutil.copy2", "progress_tracker.track_progress_callback"]
0
[]
The function (_snapshot_object_to_cas) defined within the public class called S3AssetUploader.The function start at line 647 and ends at 664. It contains 14 lines of code and it has a cyclomatic complexity of 2. It takes 6 parameters, represented as [647.0] and does not return any value. It declares 6.0 functions, and It has 6.0 functions called inside which are ["source_root.joinpath", "self._generate_s3_upload_key", "stat", "local_path.resolve", "shutil.copy2", "progress_tracker.track_progress_callback"].
aws-deadline_deadline-cloud
public
public
0
0
upload_file_to_s3.handler
def handler(bytes_uploaded):nonlocal progress_trackernonlocal futureif progress_tracker:should_continue = progress_tracker.track_progress_callback(bytes_uploaded)if not should_continue and future is not None:future.cancel()
4
7
1
34
0
684
691
684
null
[]
None
null
0
0
0
null
0
null
The function (upload_file_to_s3.handler) defined within the public class called public.The function start at line 684 and ends at 691. It contains 7 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value..
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
upload_file_to_s3
def upload_file_to_s3(self,local_path: Path,s3_bucket: str,s3_upload_key: str,progress_tracker: Optional[ProgressTracker] = None,base_dir_path: Optional[Path] = None,) -> None:"""Uploads a single file to an S3 bucket using TransferManager, allowing mid-waycancellation. It monitors for upload progress through a callback, `handler`,which also checks if the upload should continue or not. If the `progress_tracker`signals to stop, the ongoing upload is cancelled."""transfer_manager = get_s3_transfer_manager(s3_client=self._s3)future: concurrent.futures.Futuredef handler(bytes_uploaded):nonlocal progress_trackernonlocal futureif progress_tracker:should_continue = progress_tracker.track_progress_callback(bytes_uploaded)if not should_continue and future is not None:future.cancel()subscribers = [ProgressCallbackInvoker(handler)]real_path = local_path.resolve()if base_dir_path:# If base_dir_path is given, check if the file is actually within the base directoryis_file_within_base_dir = self._is_file_within_directory(real_path, base_dir_path)else:# If base_dir_path is not set, assume the file is within the base directory.is_file_within_base_dir = True# Skip the file if it's (1) a directory, 2. not existing, or 3. not within the base directory.if real_path.is_dir() or not real_path.exists() or not is_file_within_base_dir:returnwith self._open_non_symlink_file_binary(str(real_path)) as file_obj:if file_obj is None:returnfuture = transfer_manager.upload(fileobj=file_obj,bucket=s3_bucket,key=s3_upload_key,subscribers=subscribers,)try:future.result()is_uploaded = Trueif progress_tracker and is_uploaded:progress_tracker.increase_processed(1, 0)except concurrent.futures.CancelledError as ce:if progress_tracker and progress_tracker.continue_reporting is False:raise AssetSyncCancelledError("File upload cancelled.", progress_tracker.get_summary_statistics())else:raise AssetSyncError("File upload failed.", ce) from ceexcept ClientError as exc:status_code = int(exc.response["ResponseMetadata"]["HTTPStatusCode"])status_code_guidance = {**COMMON_ERROR_GUIDANCE_FOR_S3,403: (("Forbidden or Access denied. Please check your AWS credentials, and ensure that ""your AWS IAM Role or User has the 's3:PutObject' permission for this bucket. ")if "kms:" not in str(exc)else ("Forbidden or Access denied. Please check your AWS credentials and Job Attachments S3 bucket ""encryption settings. If a customer-managed KMS key is set, confirm that your AWS IAM Role or ""User has the 'kms:GenerateDataKey' and 'kms:DescribeKey' permissions for the key used to encrypt the bucket.")),404: "Not found. Please check your bucket name and object key, and ensure that they exist in the AWS account.",}raise JobAttachmentsS3ClientError(action="uploading file",status_code=status_code,bucket_name=s3_bucket,key_or_prefix=s3_upload_key,message=f"{status_code_guidance.get(status_code, '')} {str(exc)} (Failed to upload {str(local_path)})",) from excexcept BotoCoreError as bce:raise JobAttachmentS3BotoCoreError(action="uploading file",error_details=str(bce),) from bceexcept Exception as e:raise AssetSyncError(e) from e
15
72
6
328
0
666
761
666
self,local_path,s3_bucket,s3_upload_key,progress_tracker,base_dir_path
[]
None
{"AnnAssign": 1, "Assign": 10, "Expr": 4, "If": 7, "Return": 2, "Try": 1, "With": 1}
25
96
25
["get_s3_transfer_manager", "progress_tracker.track_progress_callback", "future.cancel", "ProgressCallbackInvoker", "local_path.resolve", "self._is_file_within_directory", "real_path.is_dir", "real_path.exists", "self._open_non_symlink_file_binary", "str", "transfer_manager.upload", "future.result", "progress_tracker.increase_processed", "AssetSyncCancelledError", "progress_tracker.get_summary_statistics", "AssetSyncError", "int", "str", "JobAttachmentsS3ClientError", "status_code_guidance.get", "str", "str", "JobAttachmentS3BotoCoreError", "str", "AssetSyncError"]
0
[]
The function (upload_file_to_s3) defined within the public class called S3AssetUploader.The function start at line 666 and ends at 761. It contains 72 lines of code and it has a cyclomatic complexity of 15. It takes 6 parameters, represented as [666.0] and does not return any value. It declares 25.0 functions, and It has 25.0 functions called inside which are ["get_s3_transfer_manager", "progress_tracker.track_progress_callback", "future.cancel", "ProgressCallbackInvoker", "local_path.resolve", "self._is_file_within_directory", "real_path.is_dir", "real_path.exists", "self._open_non_symlink_file_binary", "str", "transfer_manager.upload", "future.result", "progress_tracker.increase_processed", "AssetSyncCancelledError", "progress_tracker.get_summary_statistics", "AssetSyncError", "int", "str", "JobAttachmentsS3ClientError", "status_code_guidance.get", "str", "str", "JobAttachmentS3BotoCoreError", "str", "AssetSyncError"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
_open_non_symlink_file_binary
def _open_non_symlink_file_binary(self, path: str) -> Generator[Optional[BufferedReader], None, None]:"""Open a file in binary mode after verifying that it is not a symbolic link.Raises:OSError: If the given path is a symbolic link or doesn't match the actual file."""fd = Nonefile_obj = Nonetry:open_flags = os.O_RDONLY# Make sure the file isn’t following a symlink to a different path.if hasattr(os, "O_NOFOLLOW"):open_flags |= os.O_NOFOLLOWelif sys.platform != "win32" and not os.path.islink(path):# We are on a non-Windows system that does not support O_NOFOLLOW. When we encounter# symbolic link, we cannot guarantee security here, so log a warning and reject the file.logger.warning(f"Job Attachments does not support files referenced by symbolic links on this system ({sys.platform}). ""Please refrain from using symbolic links in Job Attachment asset roots and use real files instead. "f"The following file will be skipped: {path}.")yield Nonefd = os.open(path, open_flags)if sys.platform == "win32":# Windows does not support O_NOFOLLOW. So, check the file handle with GetFinalPathNameByHandle# to verify it is actually pointing to the path that we verified to be safe to open.if not self._is_path_win32_final_path_of_file_descriptor(path, fd):# ELOOP is the error code that open with NOFOLLOW will return# if the path is a symlink.We raise the same error here for# the sake of consistency.raise OSError(errno.ELOOP, "Mismatch between path and its final path", path)if str(Path(path).resolve()) != path:raise OSError(errno.ELOOP, "Mismatch between path and its final path", path)with os.fdopen(fd, "rb", closefd=False) as file_obj:yield file_objexcept OSError as e:logger.warning(f"Failed to open file. The following file will be skipped: {path}: {e}")yield Nonefinally:if fd is not None:os.close(fd)if file_obj is not None:file_obj.close()
11
32
2
199
0
764
811
764
self,path
[]
Generator[Optional[BufferedReader], None, None]
{"Assign": 4, "AugAssign": 1, "Expr": 8, "If": 7, "Try": 1, "With": 1}
14
48
14
["hasattr", "os.path.islink", "logger.warning", "os.open", "self._is_path_win32_final_path_of_file_descriptor", "OSError", "str", "resolve", "Path", "OSError", "os.fdopen", "logger.warning", "os.close", "file_obj.close"]
0
[]
The function (_open_non_symlink_file_binary) defined within the public class called S3AssetUploader.The function start at line 764 and ends at 811. It contains 32 lines of code and it has a cyclomatic complexity of 11. It takes 2 parameters, represented as [764.0] and does not return any value. It declares 14.0 functions, and It has 14.0 functions called inside which are ["hasattr", "os.path.islink", "logger.warning", "os.open", "self._is_path_win32_final_path_of_file_descriptor", "OSError", "str", "resolve", "Path", "OSError", "os.fdopen", "logger.warning", "os.close", "file_obj.close"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
_is_path_win32_final_path_of_file_descriptor
def _is_path_win32_final_path_of_file_descriptor(self, path: str, fd: int):"""Check if the normalized path from the file descriptor matches the specified path."""if sys.platform != "win32":raise EnvironmentError("This function can only be executed on Windows systems.")import ctypesimport msvcrtfrom ._windows import file as win_file# Get the handle from the file descriptortry:h = msvcrt.get_osfhandle(fd)except OSError as e:logger.warning(f"Error resolving file descriptor ({fd}) to '{path}': {e}")return False# Get the final path name using Win32 API GetFinalPathNameByHandleWbuffer_len = 4096buffer = ctypes.create_unicode_buffer(buffer_len)path_len = win_file.GetFinalPathNameByHandleW(h,buffer,buffer_len,win_file.VOLUME_NAME_DOS,)if path_len == 0:ctypes.WinError()elif path_len > buffer_len:# path_len has the required buffer length (returned by GetFinalPathNameByHandleW)# Create a buffer of this size and call the API againbuffer_len = path_lenbuffer = ctypes.create_unicode_buffer(buffer_len)path_len = win_file.GetFinalPathNameByHandleW(h,buffer,buffer_len,win_file.VOLUME_NAME_DOS,)if path_len != buffer_len or path_len == 0:# MS documentation states that if GetFinalPathNameByHandleW returns a positive value# greater than the initial buffer length, it is the required buffer length to fit the# path name. This branch uses the that value to create a new buffer, so this should# never fail unless GetFinalPathNameByHandleW behavior has changed.logger.error("GetFinalPathNameByHandleW reported incorrect required buffer length. "f"Rejecting file at '{path}'")return Falsefinal_path = ctypes.wstring_at(buffer)# GetFinalPathNameByHandleW() returns a path that starts with the \\?\# prefix, which pathlib.Path.resolve() removes.The following is intended# to match the behavior of resolve().prefix = r"\\?" "\\"unc_prefix = r"\\?\UNC" "\\"if final_path.startswith(prefix) and not path.startswith(prefix):if final_path.startswith(unc_prefix):simplified_path = "\\\\" + final_path[len(unc_prefix) :]else:simplified_path = final_path[len(prefix) :]final_path = simplified_pathreturn path == final_path
10
46
3
224
0
813
881
813
self,path,fd
[]
Returns
{"Assign": 13, "Expr": 4, "If": 6, "Return": 3, "Try": 1}
15
69
15
["EnvironmentError", "msvcrt.get_osfhandle", "logger.warning", "ctypes.create_unicode_buffer", "win_file.GetFinalPathNameByHandleW", "ctypes.WinError", "ctypes.create_unicode_buffer", "win_file.GetFinalPathNameByHandleW", "logger.error", "ctypes.wstring_at", "final_path.startswith", "path.startswith", "final_path.startswith", "len", "len"]
0
[]
The function (_is_path_win32_final_path_of_file_descriptor) defined within the public class called S3AssetUploader.The function start at line 813 and ends at 881. It contains 46 lines of code and it has a cyclomatic complexity of 10. It takes 3 parameters, represented as [813.0], and this function return a value. It declares 15.0 functions, and It has 15.0 functions called inside which are ["EnvironmentError", "msvcrt.get_osfhandle", "logger.warning", "ctypes.create_unicode_buffer", "win_file.GetFinalPathNameByHandleW", "ctypes.WinError", "ctypes.create_unicode_buffer", "win_file.GetFinalPathNameByHandleW", "logger.error", "ctypes.wstring_at", "final_path.startswith", "path.startswith", "final_path.startswith", "len", "len"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
_is_file_within_directory
def _is_file_within_directory(self, file_path: Path, directory_path: Path) -> bool:"""Checks if the given file path is within the given directory path."""real_file_path = file_path.resolve()real_directory_path = directory_path.resolve()common_path = os.path.commonpath([real_file_path, real_directory_path])return common_path.startswith(str(real_directory_path))
1
5
3
54
0
883
890
883
self,file_path,directory_path
[]
bool
{"Assign": 3, "Expr": 1, "Return": 1}
5
8
5
["file_path.resolve", "directory_path.resolve", "os.path.commonpath", "common_path.startswith", "str"]
0
[]
The function (_is_file_within_directory) defined within the public class called S3AssetUploader.The function start at line 883 and ends at 890. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [883.0] and does not return any value. It declares 5.0 functions, and It has 5.0 functions called inside which are ["file_path.resolve", "directory_path.resolve", "os.path.commonpath", "common_path.startswith", "str"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
file_already_uploaded
def file_already_uploaded(self, bucket: str, key: str) -> bool:"""Check whether the file has already been uploaded by doing a head-object call."""try:self._s3.head_object(Bucket=bucket,Key=key,)return Trueexcept ClientError as exc:error_code = int(exc.response["ResponseMetadata"]["HTTPStatusCode"])if error_code == 403:message = (f"Access denied. Ensure that the bucket is in the account {get_account_id(session=self._session)}, ""and your AWS IAM Role or User has the 's3:ListBucket' permission for this bucket.")raise JobAttachmentsS3ClientError("checking if object exists", error_code, bucket, key, message) from excreturn Falseexcept BotoCoreError as bce:raise JobAttachmentS3BotoCoreError(action="checking for the existence of an object in the S3 bucket",error_details=str(bce),) from bceexcept Exception as e:raise AssetSyncError(e) from e
5
25
3
117
0
892
919
892
self,bucket,key
[]
bool
{"Assign": 2, "Expr": 2, "If": 1, "Return": 2, "Try": 1}
7
28
7
["self._s3.head_object", "int", "get_account_id", "JobAttachmentsS3ClientError", "JobAttachmentS3BotoCoreError", "str", "AssetSyncError"]
0
[]
The function (file_already_uploaded) defined within the public class called S3AssetUploader.The function start at line 892 and ends at 919. It contains 25 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [892.0] and does not return any value. It declares 7.0 functions, and It has 7.0 functions called inside which are ["self._s3.head_object", "int", "get_account_id", "JobAttachmentsS3ClientError", "JobAttachmentS3BotoCoreError", "str", "AssetSyncError"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
upload_bytes_to_s3
def upload_bytes_to_s3(self,bytes: BytesIO,bucket: str,key: str,progress_handler: Optional[Callable[[int], None]] = None,extra_args: dict[str, Any] = dict(),) -> None:try:extra_args_merged: dict[str, Union[str, dict]] = {"ExpectedBucketOwner": get_account_id(session=self._session),**extra_args,}self._s3.upload_fileobj(bytes,bucket,key,ExtraArgs=extra_args_merged,Callback=progress_handler,)except ClientError as exc:status_code = int(exc.response["ResponseMetadata"]["HTTPStatusCode"])status_code_guidance = {**COMMON_ERROR_GUIDANCE_FOR_S3,403: (("Forbidden or Access denied. Please check your AWS credentials, and ensure that ""your AWS IAM Role or User has the 's3:PutObject' permission for this bucket. ")if "kms:" not in str(exc)else ("Forbidden or Access denied. Please check your AWS credentials and Job Attachments S3 bucket ""encryption settings. If a customer-managed KMS key is set, confirm that your AWS IAM Role or ""User has the 'kms:GenerateDataKey' and 'kms:DescribeKey' permissions for the key used to encrypt the bucket.")),404: "Not found. Please check your bucket name, and ensure that it exists in the AWS account.",}raise JobAttachmentsS3ClientError(action="uploading binary file",status_code=status_code,bucket_name=bucket,key_or_prefix=key,message=f"{status_code_guidance.get(status_code, '')} {str(exc)}",) from excexcept BotoCoreError as bce:raise JobAttachmentS3BotoCoreError(action="uploading binary file",error_details=str(bce),) from bceexcept Exception as e:raise AssetSyncError(e) from e
5
52
7
216
0
921
973
921
self,bytes,bucket,key,progress_handler,extra_args
[]
None
{"AnnAssign": 1, "Assign": 2, "Expr": 1, "Try": 1}
11
53
11
["dict", "get_account_id", "self._s3.upload_fileobj", "int", "str", "JobAttachmentsS3ClientError", "status_code_guidance.get", "str", "JobAttachmentS3BotoCoreError", "str", "AssetSyncError"]
0
[]
The function (upload_bytes_to_s3) defined within the public class called S3AssetUploader.The function start at line 921 and ends at 973. It contains 52 lines of code and it has a cyclomatic complexity of 5. It takes 7 parameters, represented as [921.0] and does not return any value. It declares 11.0 functions, and It has 11.0 functions called inside which are ["dict", "get_account_id", "self._s3.upload_fileobj", "int", "str", "JobAttachmentsS3ClientError", "status_code_guidance.get", "str", "JobAttachmentS3BotoCoreError", "str", "AssetSyncError"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
__init__
def __init__(self,farm_id: Optional[str] = None,queue_id: Optional[str] = None,job_attachment_settings: Optional[JobAttachmentS3Settings] = None,asset_uploader: Optional[S3AssetUploader] = None,session: Optional[boto3.Session] = None,asset_manifest_version: ManifestVersion = ManifestVersion.v2023_03_03,) -> None:self.farm_id = farm_idself.queue_id = queue_idself.job_attachment_settings: Optional[JobAttachmentS3Settings] = job_attachment_settingsif self.job_attachment_settings:if not self.job_attachment_settings.s3BucketName:raise MissingS3BucketError("To use Job Attachments, the 's3BucketName' must be set in your queue's JobAttachmentSettings")if not self.job_attachment_settings.rootPrefix:raise MissingS3RootPrefixError("To use Job Attachments, the 'rootPrefix' must be set in your queue's JobAttachmentSettings")if asset_uploader is None:asset_uploader = S3AssetUploader(session=session)self.asset_uploader = asset_uploaderself.session = sessionself.manifest_version: ManifestVersion = asset_manifest_version
5
26
7
144
0
981
1,010
981
self,session
[]
None
{"Assign": 11, "If": 5, "Try": 1}
10
46
10
["get_boto3_session", "int", "config_file.get_setting", "int", "config_file.get_setting", "int", "min", "AssetSyncError", "get_s3_client", "AssetSyncError"]
4,993
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16379211_lorcalhost_btb_manager_telegram.btb_manager_telegram.logging_py.LoggerHandler.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16379211_lorcalhost_btb_manager_telegram.btb_manager_telegram.schedule_py.TgScheduler.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.CalculatedAmountDiscrepancyError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.ExchangeRateMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.InvalidTransactionError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.ParsingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.PriceMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.QuantityNotPositiveError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.SymbolMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.UnexpectedColumnCountError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.UnexpectedRowCountError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.raw_py.RawTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.schwab_equity_award_json_py.SchwabTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.schwab_py.SchwabTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.trading212_py.Trading212Transaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.vanguard_py.VanguardTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.ExporterError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.FritzPasswordFileDoesNotExistError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.FritzPasswordTooLongError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.DeviceInfo.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HomeAutomation.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HostInfo.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HostNumberOfEntries.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.LanInterfaceConfig.__init__"]
The function (__init__) defined within the public class called S3AssetUploader.The function start at line 981 and ends at 1010. It contains 26 lines of code and it has a cyclomatic complexity of 5. It takes 7 parameters, represented as [981.0] and does not return any value. It declares 10.0 functions, It has 10.0 functions called inside which are ["get_boto3_session", "int", "config_file.get_setting", "int", "config_file.get_setting", "int", "min", "AssetSyncError", "get_s3_client", "AssetSyncError"], It has 4993.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16379211_lorcalhost_btb_manager_telegram.btb_manager_telegram.logging_py.LoggerHandler.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16379211_lorcalhost_btb_manager_telegram.btb_manager_telegram.schedule_py.TgScheduler.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.CalculatedAmountDiscrepancyError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.ExchangeRateMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.InvalidTransactionError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.ParsingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.PriceMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.QuantityNotPositiveError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.SymbolMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.UnexpectedColumnCountError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.UnexpectedRowCountError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.raw_py.RawTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.schwab_equity_award_json_py.SchwabTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.schwab_py.SchwabTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.trading212_py.Trading212Transaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.vanguard_py.VanguardTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.ExporterError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.FritzPasswordFileDoesNotExistError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.FritzPasswordTooLongError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.DeviceInfo.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HomeAutomation.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HostInfo.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HostNumberOfEntries.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.LanInterfaceConfig.__init__"].
aws-deadline_deadline-cloud
S3AssetManager
public
0
0
_process_input_path
def _process_input_path(self,path: Path,root_path: str,hash_cache: HashCache,progress_tracker: Optional[ProgressTracker] = None,update: bool = True,) -> Tuple[FileStatus, int, base_manifest.BaseManifestPath]:# If it's cancelled, raise an AssetSyncCancelledError exceptionif progress_tracker and not progress_tracker.continue_reporting:raise AssetSyncCancelledError("File hashing cancelled.", progress_tracker.get_summary_statistics())manifest_model: Type[BaseManifestModel] = ManifestModelRegistry.get_manifest_model(version=self.manifest_version)hash_alg: HashAlgorithm = manifest_model.AssetManifest.get_default_hash_alg()full_path = str(path.resolve())file_status: FileStatus = FileStatus.UNCHANGEDactual_modified_time = str(datetime.fromtimestamp(path.stat().st_mtime))entry: Optional[HashCacheEntry] = hash_cache.get_connection_entry(full_path, hash_alg, connection=hash_cache.get_local_connection())if entry is not None:# If the file was modified, we need to rehash itif actual_modified_time != entry.last_modified_time:entry.last_modified_time = actual_modified_timeentry.file_hash = hash_file(full_path, hash_alg)entry.hash_algorithm = hash_algfile_status = FileStatus.MODIFIEDelse:entry = HashCacheEntry(file_path=full_path,hash_algorithm=hash_alg,file_hash=hash_file(full_path, hash_alg),last_modified_time=actual_modified_time,)file_status = FileStatus.NEWif file_status != FileStatus.UNCHANGED and update:hash_cache.put_entry(entry)file_size = path.resolve().stat().st_sizepath_args: dict[str, Any] = {"path": path.relative_to(root_path).as_posix(),"hash": entry.file_hash,}# stat().st_mtime_ns returns an int that represents the time in nanoseconds since the epoch.# The asset manifest spec requires the mtime to be represented as an integer in microseconds.path_args["mtime"] = trunc(path.stat().st_mtime_ns // 1000)path_args["size"] = file_sizereturn (file_status, file_size, manifest_model.Path(**path_args))
7
46
6
312
0
1,012
1,068
1,012
self,path,root_path,hash_cache,progress_tracker,update
[]
Tuple[FileStatus, int, base_manifest.BaseManifestPath]
{"AnnAssign": 5, "Assign": 11, "Expr": 1, "If": 4, "Return": 1}
22
57
22
["AssetSyncCancelledError", "progress_tracker.get_summary_statistics", "ManifestModelRegistry.get_manifest_model", "manifest_model.AssetManifest.get_default_hash_alg", "str", "path.resolve", "str", "datetime.fromtimestamp", "path.stat", "hash_cache.get_connection_entry", "hash_cache.get_local_connection", "hash_file", "HashCacheEntry", "hash_file", "hash_cache.put_entry", "stat", "path.resolve", "as_posix", "path.relative_to", "trunc", "path.stat", "manifest_model.Path"]
0
[]
The function (_process_input_path) defined within the public class called S3AssetManager.The function start at line 1012 and ends at 1068. It contains 46 lines of code and it has a cyclomatic complexity of 7. It takes 6 parameters, represented as [1012.0] and does not return any value. It declares 22.0 functions, and It has 22.0 functions called inside which are ["AssetSyncCancelledError", "progress_tracker.get_summary_statistics", "ManifestModelRegistry.get_manifest_model", "manifest_model.AssetManifest.get_default_hash_alg", "str", "path.resolve", "str", "datetime.fromtimestamp", "path.stat", "hash_cache.get_connection_entry", "hash_cache.get_local_connection", "hash_file", "HashCacheEntry", "hash_file", "hash_cache.put_entry", "stat", "path.resolve", "as_posix", "path.relative_to", "trunc", "path.stat", "manifest_model.Path"].
aws-deadline_deadline-cloud
S3AssetManager
public
0
0
_create_manifest_file
def _create_manifest_file(self,input_paths: list[Path],root_path: str,hash_cache: HashCache,progress_tracker: Optional[ProgressTracker] = None,) -> BaseAssetManifest:manifest_model: Type[BaseManifestModel] = ManifestModelRegistry.get_manifest_model(version=self.manifest_version)if manifest_model.manifest_version in {ManifestVersion.v2023_03_03,}:paths: list[base_manifest.BaseManifestPath] = []with concurrent.futures.ThreadPoolExecutor() as executor:futures = {executor.submit(self._process_input_path, path, root_path, hash_cache, progress_tracker): pathfor path in input_paths}for future in concurrent.futures.as_completed(futures):(file_status, file_size, path_to_put_in_manifest) = future.result()paths.append(path_to_put_in_manifest)if progress_tracker:if file_status == FileStatus.NEW or file_status == FileStatus.MODIFIED:progress_tracker.increase_processed(1, file_size)else:progress_tracker.increase_skipped(1, file_size)progress_tracker.report_progress()# Need to sort the list to keep it canonicalpaths.sort(key=lambda x: x.path, reverse=True)manifest_args: dict[str, Any] = {"hash_alg": manifest_model.AssetManifest.get_default_hash_alg(),"paths": paths,}manifest_args["total_size"] = sum([path.size for path in paths])return manifest_model.AssetManifest(**manifest_args)else:raise NotImplementedError(f"Creation of manifest version {manifest_model.manifest_version} is not supported.")
8
41
5
254
0
1,070
1,116
1,070
self,input_paths,root_path,hash_cache,progress_tracker
[]
BaseAssetManifest
{"AnnAssign": 3, "Assign": 3, "Expr": 5, "For": 1, "If": 3, "Return": 1, "With": 1}
14
47
14
["ManifestModelRegistry.get_manifest_model", "concurrent.futures.ThreadPoolExecutor", "executor.submit", "concurrent.futures.as_completed", "future.result", "paths.append", "progress_tracker.increase_processed", "progress_tracker.increase_skipped", "progress_tracker.report_progress", "paths.sort", "manifest_model.AssetManifest.get_default_hash_alg", "sum", "manifest_model.AssetManifest", "NotImplementedError"]
0
[]
The function (_create_manifest_file) defined within the public class called S3AssetManager.The function start at line 1070 and ends at 1116. It contains 41 lines of code and it has a cyclomatic complexity of 8. It takes 5 parameters, represented as [1070.0] and does not return any value. It declares 14.0 functions, and It has 14.0 functions called inside which are ["ManifestModelRegistry.get_manifest_model", "concurrent.futures.ThreadPoolExecutor", "executor.submit", "concurrent.futures.as_completed", "future.result", "paths.append", "progress_tracker.increase_processed", "progress_tracker.increase_skipped", "progress_tracker.report_progress", "paths.sort", "manifest_model.AssetManifest.get_default_hash_alg", "sum", "manifest_model.AssetManifest", "NotImplementedError"].
aws-deadline_deadline-cloud
S3AssetManager
public
0
0
_get_asset_groups
def _get_asset_groups(self,input_paths: set[str],output_paths: set[str],referenced_paths: set[str],local_type_locations: dict[str, str] = {},shared_type_locations: dict[str, str] = {},require_paths_exist: bool = False,) -> list[AssetRootGroup]:"""For the given input paths and output paths, a list of groups is returned, where paths sharingthe same root path are grouped together. Note that paths can be files or directories.The returned list satisfies the following conditions:- If a path is relative to any of the paths in the given `shared_type_locations` paths, it isexcluded from the list.- The given `local_type_locations` paths can each form a group based on its root path. In otherwords, if there are paths relative to any of the `local_type_locations` paths, they are groupedtogether as one.- The referenced paths may have no files or directories associated, but they always liverelative to one of the AssetRootGroup objects returned."""groupings: dict[str, AssetRootGroup] = {}missing_input_paths = set()misconfigured_directories = set()# Resolve full path, then cast to pure path to get top-level directoryfor _path in input_paths:# Need to use absolute to not resolve symlinks, but need normpath to get rid of relative paths, i.e. '..'abs_path = Path(os.path.normpath(Path(_path).absolute()))if not abs_path.exists():if require_paths_exist:missing_input_paths.add(abs_path)else:logger.warning(f"Input path '{_path}' resolving to '{abs_path}' does not exist. Adding to referenced paths.")referenced_paths.add(_path)continueif abs_path.is_dir():misconfigured_directories.add(abs_path)continue# Skips the upload if the path is relative to any of the File System Location# of SHARED type that was set in the Job.if any(_is_relative_to(abs_path, shared) for shared in shared_type_locations):continue# If the path is relative to any of the File System Location of LOCAL type,# groups the files into a single group using the path of that location.matched_root = self._find_matched_root_from_local_type_locations(groupings=groupings,abs_path=abs_path,local_type_locations=local_type_locations,)matched_group = self._get_matched_group(matched_root, groupings)matched_group.inputs.add(abs_path)if missing_input_paths or misconfigured_directories:all_misconfigured_inputs = ""misconfigured_inputs_msg = ("Job submission contains missing input files or directories specified as files."" All inputs must exist and be classified properly.")if missing_input_paths:missing_inputs_list: list[str] = sorted([str(i) for i in missing_input_paths])all_missing_inputs = "\n\t".join(missing_inputs_list)all_misconfigured_inputs += f"\nMissing input files:\n\t{all_missing_inputs}"if misconfigured_directories:misconfigured_directories_list: list[str] = sorted([str(d) for d in misconfigured_directories])all_misconfigured_directories = "\n\t".join(misconfigured_directories_list)all_misconfigured_inputs += (f"\nDirectories classified as files:\n\t{all_misconfigured_directories}")raise MisconfiguredInputsError(misconfigured_inputs_msg + all_misconfigured_inputs)for _path in output_paths:abs_path = Path(os.path.normpath(Path(_path).absolute()))# Skips the upload if the path is relative to any of the File System Location# of SHARED type that was set in the Job.if any(_is_relative_to(abs_path, shared) for shared in shared_type_locations):continue# If the path is relative to any of the File System Location of LOCAL type,# groups the files into a single group using the path of that location.matched_root = self._find_matched_root_from_local_type_locations(groupings=groupings,abs_path=abs_path,local_type_locations=local_type_locations,)matched_group = self._get_matched_group(matched_root, groupings)matched_group.outputs.add(abs_path)for _path in referenced_paths:abs_path = Path(os.path.normpath(Path(_path).absolute()))# Skips the reference if the path is relative to any of the File System Location# of SHARED type that was set in the Job.if any(_is_relative_to(abs_path, shared) for shared in shared_type_locations):continue# If the path is relative to any of the File System Location of LOCAL type,# groups the references into a single group using the path of that location.matched_root = self._find_matched_root_from_local_type_locations(groupings=groupings,abs_path=abs_path,local_type_locations=local_type_locations,)matched_group = self._get_matched_group(matched_root, groupings)matched_group.references.add(abs_path)# Finally, build the list of asset root groupsfor asset_group in groupings.values():common_path: Path = Path(os.path.commonpath(list(asset_group.inputs | asset_group.outputs | asset_group.references)))if common_path.is_file():common_path = common_path.parentasset_group.root_path = str(common_path)return sorted(groupings.values(), key=lambda v: (v.root_path, v.file_system_location_name))
21
86
7
539
0
1,118
1,242
1,118
self,input_paths,output_paths,referenced_paths,local_type_locations,shared_type_locations,require_paths_exist
[]
list[AssetRootGroup]
{"AnnAssign": 4, "Assign": 17, "AugAssign": 2, "Expr": 8, "For": 4, "If": 10, "Return": 1}
50
125
50
["set", "set", "Path", "os.path.normpath", "absolute", "Path", "abs_path.exists", "missing_input_paths.add", "logger.warning", "referenced_paths.add", "abs_path.is_dir", "misconfigured_directories.add", "any", "_is_relative_to", "self._find_matched_root_from_local_type_locations", "self._get_matched_group", "matched_group.inputs.add", "sorted", "str", "join", "sorted", "str", "join", "MisconfiguredInputsError", "Path", "os.path.normpath", "absolute", "Path", "any", "_is_relative_to", "self._find_matched_root_from_local_type_locations", "self._get_matched_group", "matched_group.outputs.add", "Path", "os.path.normpath", "absolute", "Path", "any", "_is_relative_to", "self._find_matched_root_from_local_type_locations", "self._get_matched_group", "matched_group.references.add", "groupings.values", "Path", "os.path.commonpath", "list", "common_path.is_file", "str", "sorted", "groupings.values"]
0
[]
The function (_get_asset_groups) defined within the public class called S3AssetManager.The function start at line 1118 and ends at 1242. It contains 86 lines of code and it has a cyclomatic complexity of 21. It takes 7 parameters, represented as [1118.0] and does not return any value. It declares 50.0 functions, and It has 50.0 functions called inside which are ["set", "set", "Path", "os.path.normpath", "absolute", "Path", "abs_path.exists", "missing_input_paths.add", "logger.warning", "referenced_paths.add", "abs_path.is_dir", "misconfigured_directories.add", "any", "_is_relative_to", "self._find_matched_root_from_local_type_locations", "self._get_matched_group", "matched_group.inputs.add", "sorted", "str", "join", "sorted", "str", "join", "MisconfiguredInputsError", "Path", "os.path.normpath", "absolute", "Path", "any", "_is_relative_to", "self._find_matched_root_from_local_type_locations", "self._get_matched_group", "matched_group.outputs.add", "Path", "os.path.normpath", "absolute", "Path", "any", "_is_relative_to", "self._find_matched_root_from_local_type_locations", "self._get_matched_group", "matched_group.references.add", "groupings.values", "Path", "os.path.commonpath", "list", "common_path.is_file", "str", "sorted", "groupings.values"].
aws-deadline_deadline-cloud
S3AssetManager
public
0
0
_get_matched_group
def _get_matched_group(self, root_path: str, groupings: dict[str, AssetRootGroup]) -> AssetRootGroup:root_normcase = os.path.normcase(root_path)matched_group = next((group for key, group in groupings.items() if os.path.normcase(key) == root_normcase),None,)if matched_group is None:raise ValueError(f"No group found for the root path '{root_path}' in the groupings dictionary: {groupings}")return matched_group
4
13
3
75
0
1,244
1,256
1,244
self,root_path,groupings
[]
AssetRootGroup
{"Assign": 2, "If": 1, "Return": 1}
5
13
5
["os.path.normcase", "next", "groupings.items", "os.path.normcase", "ValueError"]
0
[]
The function (_get_matched_group) defined within the public class called S3AssetManager.The function start at line 1244 and ends at 1256. It contains 13 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [1244.0] and does not return any value. It declares 5.0 functions, and It has 5.0 functions called inside which are ["os.path.normcase", "next", "groupings.items", "os.path.normcase", "ValueError"].
aws-deadline_deadline-cloud
S3AssetManager
public
0
0
_find_matched_root_from_local_type_locations
def _find_matched_root_from_local_type_locations(self,groupings: dict[str, AssetRootGroup],abs_path: Path,local_type_locations: dict[str, str] = {},) -> str:"""Checks if the given `abs_path` is relative to any of the File System Locations of LOCAL type.If it is, select the most specific File System Location, and add a new grouping keyed by thatmatched root path (if the key does not exist.) Then, returns the matched root path.If no match is found, returns the top directory of `abs_path` as the key used for grouping."""matched_root = Nonefor root_path in local_type_locations.keys():if _is_relative_to(abs_path, root_path) and (matched_root is None or len(root_path) > len(matched_root)):matched_root = root_pathif matched_root is not None:if matched_root not in groupings:groupings[matched_root] = AssetRootGroup(file_system_location_name=local_type_locations[matched_root],)return matched_rootelse:keys_normcase = [os.path.normcase(key) for key in groupings.keys()]top_directory = PurePath(abs_path).parts[0]top_directory_normcase = os.path.normcase(top_directory)if top_directory_normcase not in keys_normcase:groupings[top_directory] = AssetRootGroup()else:return top_directory_normcasereturn top_directory
9
27
4
165
0
1,258
1,291
1,258
self,groupings,abs_path,local_type_locations
[]
str
{"Assign": 7, "Expr": 1, "For": 1, "If": 4, "Return": 3}
10
34
10
["local_type_locations.keys", "_is_relative_to", "len", "len", "AssetRootGroup", "os.path.normcase", "groupings.keys", "PurePath", "os.path.normcase", "AssetRootGroup"]
0
[]
The function (_find_matched_root_from_local_type_locations) defined within the public class called S3AssetManager.The function start at line 1258 and ends at 1291. It contains 27 lines of code and it has a cyclomatic complexity of 9. It takes 4 parameters, represented as [1258.0] and does not return any value. It declares 10.0 functions, and It has 10.0 functions called inside which are ["local_type_locations.keys", "_is_relative_to", "len", "len", "AssetRootGroup", "os.path.normcase", "groupings.keys", "PurePath", "os.path.normcase", "AssetRootGroup"].
aws-deadline_deadline-cloud
public
public
0
0
_get_total_size_of_files.get_file_size
def get_file_size(path_str: str) -> int:try:return Path(path_str).resolve().stat().st_sizeexcept (FileNotFoundError, PermissionError, OSError):logger.warning(f"Skipping file in size calculation: {path_str}")return 0
2
6
1
44
0
1,294
1,299
1,294
null
[]
None
null
0
0
0
null
0
null
The function (_get_total_size_of_files.get_file_size) defined within the public class called public.The function start at line 1294 and ends at 1299. It contains 6 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
aws-deadline_deadline-cloud
S3AssetManager
public
0
0
_get_total_size_of_files
def _get_total_size_of_files(self, paths: list[str]) -> int:def get_file_size(path_str: str) -> int:try:return Path(path_str).resolve().stat().st_sizeexcept (FileNotFoundError, PermissionError, OSError):logger.warning(f"Skipping file in size calculation: {path_str}")return 0with concurrent.futures.ThreadPoolExecutor(max_workers=8) as executor:sizes = list(executor.map(get_file_size, paths))return sum(sizes)
1
5
2
48
0
1,293
1,304
1,293
self,paths
[]
int
{"Assign": 1, "Expr": 1, "Return": 3, "Try": 1, "With": 1}
8
12
8
["stat", "resolve", "Path", "logger.warning", "concurrent.futures.ThreadPoolExecutor", "list", "executor.map", "sum"]
0
[]
The function (_get_total_size_of_files) defined within the public class called S3AssetManager.The function start at line 1293 and ends at 1304. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1293.0] and does not return any value. It declares 8.0 functions, and It has 8.0 functions called inside which are ["stat", "resolve", "Path", "logger.warning", "concurrent.futures.ThreadPoolExecutor", "list", "executor.map", "sum"].
aws-deadline_deadline-cloud
S3AssetManager
public
0
0
_get_total_input_size_from_manifests
def _get_total_input_size_from_manifests(self, manifests: list[AssetRootManifest]) -> tuple[int, int]:total_files = 0total_bytes = 0for asset_root_manifest in manifests:if asset_root_manifest.asset_manifest:total_files += len(asset_root_manifest.asset_manifest.paths)for path in asset_root_manifest.asset_manifest.paths:total_bytes += path.sizereturn (total_files, total_bytes)
4
11
2
65
0
1,306
1,316
1,306
self,manifests
[]
tuple[int, int]
{"Assign": 2, "AugAssign": 2, "For": 2, "If": 1, "Return": 1}
1
11
1
["len"]
0
[]
The function (_get_total_input_size_from_manifests) defined within the public class called S3AssetManager.The function start at line 1306 and ends at 1316. It contains 11 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [1306.0] and does not return any value. It declare 1.0 function, and It has 1.0 function called inside which is ["len"].
aws-deadline_deadline-cloud
S3AssetManager
public
0
0
_get_total_input_size_from_asset_group
def _get_total_input_size_from_asset_group(self, groups: list[AssetRootGroup]) -> tuple[int, int]:total_files = 0total_bytes = 0for group in groups:input_paths = [str(input) for input in group.inputs]total_bytes += self._get_total_size_of_files(input_paths)total_files += len(input_paths)return (total_files, total_bytes)
3
10
2
64
0
1,318
1,327
1,318
self,groups
[]
tuple[int, int]
{"Assign": 3, "AugAssign": 2, "For": 1, "Return": 1}
3
10
3
["str", "self._get_total_size_of_files", "len"]
0
[]
The function (_get_total_input_size_from_asset_group) defined within the public class called S3AssetManager.The function start at line 1318 and ends at 1327. It contains 10 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [1318.0] and does not return any value. It declares 3.0 functions, and It has 3.0 functions called inside which are ["str", "self._get_total_size_of_files", "len"].
aws-deadline_deadline-cloud
S3AssetManager
public
0
0
_get_file_system_locations_by_type
def _get_file_system_locations_by_type(self,storage_profile_for_queue: StorageProfile,) -> Tuple[dict, dict]:"""Given the Storage Profile for Queue object, extracts and groupspath and name pairs from the File System Locations into two dicts,LOCAL and SHARED type, respectively. Returns a tuple of two dicts."""local_type_locations: dict[str, str] = {}shared_type_locations: dict[str, str] = {}for fs_loc in storage_profile_for_queue.fileSystemLocations:if fs_loc.type == FileSystemLocationType.LOCAL:local_type_locations[fs_loc.path] = fs_loc.nameelif fs_loc.type == FileSystemLocationType.SHARED:shared_type_locations[fs_loc.path] = fs_loc.namereturn local_type_locations, shared_type_locations
4
12
2
89
0
1,329
1,345
1,329
self,storage_profile_for_queue
[]
Tuple[dict, dict]
{"AnnAssign": 2, "Assign": 2, "Expr": 1, "For": 1, "If": 2, "Return": 1}
0
17
0
[]
0
[]
The function (_get_file_system_locations_by_type) defined within the public class called S3AssetManager.The function start at line 1329 and ends at 1345. It contains 12 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [1329.0] and does not return any value..
aws-deadline_deadline-cloud
S3AssetManager
public
0
0
_group_asset_paths
def _group_asset_paths(self,input_paths: list[str],output_paths: list[str],referenced_paths: list[str],storage_profile: Optional[StorageProfile],require_paths_exist: bool,) -> list[AssetRootGroup]:"""Resolves all of the paths that will be uploaded, sorting by storage profile location."""local_type_locations: dict[str, str] = {}shared_type_locations: dict[str, str] = {}if storage_profile:(local_type_locations,shared_type_locations,) = self._get_file_system_locations_by_type(storage_profile)# Group the paths by asset root, removing duplicates and empty stringsasset_groups: list[AssetRootGroup] = self._get_asset_groups({ip_path for ip_path in input_paths if ip_path},{op_path for op_path in output_paths if op_path},{rf_path for rf_path in referenced_paths if rf_path},local_type_locations,shared_type_locations,require_paths_exist,)return asset_groups
8
24
6
132
0
1,347
1,376
1,347
self,input_paths,output_paths,referenced_paths,storage_profile,require_paths_exist
[]
list[AssetRootGroup]
{"AnnAssign": 3, "Assign": 1, "Expr": 1, "If": 1, "Return": 1}
2
30
2
["self._get_file_system_locations_by_type", "self._get_asset_groups"]
0
[]
The function (_group_asset_paths) defined within the public class called S3AssetManager.The function start at line 1347 and ends at 1376. It contains 24 lines of code and it has a cyclomatic complexity of 8. It takes 6 parameters, represented as [1347.0] and does not return any value. It declares 2.0 functions, and It has 2.0 functions called inside which are ["self._get_file_system_locations_by_type", "self._get_asset_groups"].
aws-deadline_deadline-cloud
S3AssetManager
public
0
0
prepare_paths_for_upload
def prepare_paths_for_upload(self,input_paths: list[str],output_paths: list[str],referenced_paths: list[str],storage_profile: Optional[StorageProfile] = None,require_paths_exist: bool = False,) -> AssetUploadGroup:"""Processes all of the paths required for upload, grouping them by asset root and local storage profile locations.Returns an object containing the grouped paths, which also includes a dictionary of input directories and file countsfor files that were not under the root path or any local storage profile locations."""asset_groups = self._group_asset_paths(input_paths,output_paths,referenced_paths,storage_profile,require_paths_exist,)(input_file_count, input_bytes) = self._get_total_input_size_from_asset_group(asset_groups)return AssetUploadGroup(asset_groups=asset_groups,total_input_files=input_file_count,total_input_bytes=input_bytes,)
1
21
6
90
0
1,378
1,403
1,378
self,input_paths,output_paths,referenced_paths,storage_profile,require_paths_exist
[]
AssetUploadGroup
{"Assign": 2, "Expr": 1, "Return": 1}
3
26
3
["self._group_asset_paths", "self._get_total_input_size_from_asset_group", "AssetUploadGroup"]
0
[]
The function (prepare_paths_for_upload) defined within the public class called S3AssetManager.The function start at line 1378 and ends at 1403. It contains 21 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [1378.0] and does not return any value. It declares 3.0 functions, and It has 3.0 functions called inside which are ["self._group_asset_paths", "self._get_total_input_size_from_asset_group", "AssetUploadGroup"].
aws-deadline_deadline-cloud
S3AssetManager
public
0
0
hash_assets_and_create_manifest
def hash_assets_and_create_manifest(self,asset_groups: list[AssetRootGroup],total_input_files: int,total_input_bytes: int,hash_cache_dir: Optional[str] = None,on_preparing_to_submit: Optional[Callable[[Any], bool]] = None,) -> tuple[SummaryStatistics, list[AssetRootManifest]]:"""Computes the hashes for input files, and creates manifests using the local hash cache.Args:input_paths: a list of input paths.output_paths: a list of output paths.hash_cache_dir: a path to local hash cache directory. If it's None, use default path.on_preparing_to_submit: a callback to be called to periodically report progress to the caller.The callback returns True if the operation should continue as normal, or False to cancel.Returns:a tuple with (1) the summary statistics of the hash operation, and(2) a list of AssetRootManifest (a manifest and output paths for each asset root)."""start_time = time.perf_counter()# Sets up progress tracker to report upload progress back to the caller.progress_tracker = ProgressTracker(status=ProgressStatus.PREPARING_IN_PROGRESS,total_files=total_input_files,total_bytes=total_input_bytes,on_progress_callback=on_preparing_to_submit,)asset_root_manifests: list[AssetRootManifest] = []for group in asset_groups:# Might have output directories, but no inputs for this groupasset_manifest: Optional[BaseAssetManifest] = Noneif group.inputs:# Create manifest, using local hash cachewith HashCache(hash_cache_dir) as hash_cache:asset_manifest = self._create_manifest_file(sorted(list(group.inputs)), group.root_path, hash_cache, progress_tracker)asset_root_manifests.append(AssetRootManifest(file_system_location_name=group.file_system_location_name,root_path=group.root_path,asset_manifest=asset_manifest,outputs=sorted(list(group.outputs)),))progress_tracker.total_time = time.perf_counter() - start_timereturn (progress_tracker.get_summary_statistics(), asset_root_manifests)
3
33
7
203
0
1,405
1,459
1,405
self,asset_groups,total_input_files,total_input_bytes,hash_cache_dir,on_preparing_to_submit
[]
tuple[SummaryStatistics, list[AssetRootManifest]]
{"AnnAssign": 2, "Assign": 4, "Expr": 2, "For": 1, "If": 1, "Return": 1, "With": 1}
12
55
12
["time.perf_counter", "ProgressTracker", "HashCache", "self._create_manifest_file", "sorted", "list", "asset_root_manifests.append", "AssetRootManifest", "sorted", "list", "time.perf_counter", "progress_tracker.get_summary_statistics"]
0
[]
The function (hash_assets_and_create_manifest) defined within the public class called S3AssetManager.The function start at line 1405 and ends at 1459. It contains 33 lines of code and it has a cyclomatic complexity of 3. It takes 7 parameters, represented as [1405.0] and does not return any value. It declares 12.0 functions, and It has 12.0 functions called inside which are ["time.perf_counter", "ProgressTracker", "HashCache", "self._create_manifest_file", "sorted", "list", "asset_root_manifests.append", "AssetRootManifest", "sorted", "list", "time.perf_counter", "progress_tracker.get_summary_statistics"].
aws-deadline_deadline-cloud
S3AssetUploader
public
0
0
upload_assets
def upload_assets(self,manifests: list[AssetRootManifest],on_uploading_assets: Optional[Callable[[Any], bool]] = None,s3_check_cache_dir: Optional[str] = None,manifest_write_dir: Optional[str] = None,) -> tuple[SummaryStatistics, Attachments]:"""Uploads all the files for provided manifests and manifests themselves to S3.Args:manifests: a list of manifests that contain assets to be uploadedon_uploading_assets: a callback to be called to periodically report progress to the caller.The callback returns True if the operation should continue as normal, or False to cancel.Returns:a tuple with (1) the summary statistics of the upload operation, and(2) the S3 path to the asset manifest file."""# This is a programming error if the user did not construct the object with Farm and Queue IDs.if not self.farm_id or not self.queue_id:logger.error("upload_assets: Farm or Fleet ID is missing.")raise JobAttachmentsError("upload_assets: Farm or Fleet ID is missing.")# Sets up progress tracker to report upload progress back to the caller.(input_files, input_bytes) = self._get_total_input_size_from_manifests(manifests)progress_tracker = ProgressTracker(status=ProgressStatus.UPLOAD_IN_PROGRESS,total_files=input_files,total_bytes=input_bytes,on_progress_callback=on_uploading_assets,)start_time = time.perf_counter()manifest_properties_list: list[ManifestProperties] = []for asset_root_manifest in manifests:output_rel_paths: list[str] = [str(path.relative_to(asset_root_manifest.root_path))for path in asset_root_manifest.outputs]manifest_properties = ManifestProperties(fileSystemLocationName=asset_root_manifest.file_system_location_name,rootPath=asset_root_manifest.root_path,rootPathFormat=PathFormat.get_host_path_format(),outputRelativeDirectories=output_rel_paths,)if asset_root_manifest.asset_manifest:(partial_manifest_key, asset_manifest_hash) = self.asset_uploader.upload_assets(job_attachment_settings=self.job_attachment_settings,# type: ignore[arg-type]manifest=asset_root_manifest.asset_manifest,partial_manifest_prefix=self.job_attachment_settings.partial_manifest_prefix(# type: ignore[union-attr]self.farm_id, self.queue_id),source_root=Path(asset_root_manifest.root_path),file_system_location_name=asset_root_manifest.file_system_location_name,progress_tracker=progress_tracker,s3_check_cache_dir=s3_check_cache_dir,manifest_write_dir=manifest_write_dir,)manifest_properties.inputManifestPath = partial_manifest_keymanifest_properties.inputManifestHash = asset_manifest_hashmanifest_properties_list.append(manifest_properties)logger.debug("Asset manifests - locations in S3:")logger.debug("\n".join(filter(None,(manifest_properties.inputManifestPathfor manifest_properties in manifest_properties_list),)))progress_tracker.total_time = time.perf_counter() - start_timereturn (progress_tracker.get_summary_statistics(),Attachments(manifests=manifest_properties_list),)
7
63
6
336
0
1,461
1,547
1,461
self,job_attachment_settings,manifest,source_root,partial_manifest_prefix,file_system_location_name,progress_tracker,s3_check_cache_dir,manifest_write_dir,manifest_name_suffix,manifest_metadata,manifest_file_name,asset_root
[]
tuple[str, str]
{"Assign": 5, "Expr": 5, "If": 4, "Return": 1}
13
89
13
["dict", "S3AssetUploader._gather_upload_metadata", "_join_s3_paths", "job_attachment_settings.add_root_and_manifest_folder_prefix", "self._write_local_manifest", "self.upload_bytes_to_s3", "BytesIO", "self.verify_hash_cache_integrity", "job_attachment_settings.full_cas_prefix", "self.reset_s3_check_cache", "self.upload_input_files", "job_attachment_settings.full_cas_prefix", "hash_data"]
0
[]
The function (upload_assets) defined within the public class called S3AssetUploader.The function start at line 1461 and ends at 1547. It contains 63 lines of code and it has a cyclomatic complexity of 7. It takes 6 parameters, represented as [1461.0] and does not return any value. It declares 13.0 functions, and It has 13.0 functions called inside which are ["dict", "S3AssetUploader._gather_upload_metadata", "_join_s3_paths", "job_attachment_settings.add_root_and_manifest_folder_prefix", "self._write_local_manifest", "self.upload_bytes_to_s3", "BytesIO", "self.verify_hash_cache_integrity", "job_attachment_settings.full_cas_prefix", "self.reset_s3_check_cache", "self.upload_input_files", "job_attachment_settings.full_cas_prefix", "hash_data"].
aws-deadline_deadline-cloud
S3AssetManager
public
0
0
snapshot_assets
def snapshot_assets(self,snapshot_dir: str,manifests: list[AssetRootManifest],on_snapshotting_assets: Optional[Callable[[Any], bool]] = None,) -> tuple[SummaryStatistics, Attachments]:"""Copies all the files for provided manifests and manifests themselves into a snapshot directorythat matches the layout of a job attachments prefix in S3.Args:snapshot_dir: A directory in which to place the snapshot. Data and manifest files will go in Dataand Manifest subdirectories, respectively.manifests: A list of manifests that contain assets to be uploadedon_snapshotting_assets: A callback to be called to periodically report progress to the caller.The callback must return True if the operation should continue as normal, or False to cancel.Returns:a tuple with (1) the summary statistics of the upload operation, and(2) the S3 path to the asset manifest file."""# This is a programming error if the user did not construct the object with Farm and Queue IDs.if not self.farm_id or not self.queue_id:logger.error("snapshot_assets: Farm or Fleet ID is missing.")raise JobAttachmentsError("snapshot_assets: Farm or Fleet ID is missing.")# Sets up progress tracker to report upload progress back to the caller.(input_files, input_bytes) = self._get_total_input_size_from_manifests(manifests)progress_tracker = ProgressTracker(status=ProgressStatus.SNAPSHOT_IN_PROGRESS,total_files=input_files,total_bytes=input_bytes,on_progress_callback=on_snapshotting_assets,)start_time = time.perf_counter()manifest_properties_list: list[ManifestProperties] = []for asset_root_manifest in manifests:output_rel_paths: list[str] = [str(path.relative_to(asset_root_manifest.root_path))for path in asset_root_manifest.outputs]manifest_properties = ManifestProperties(fileSystemLocationName=asset_root_manifest.file_system_location_name,rootPath=asset_root_manifest.root_path,rootPathFormat=PathFormat.get_host_path_format(),outputRelativeDirectories=output_rel_paths,)if asset_root_manifest.asset_manifest:(partial_manifest_key, asset_manifest_hash) = self.asset_uploader._snapshot_assets(snapshot_dir=Path(snapshot_dir),manifest=asset_root_manifest.asset_manifest,partial_manifest_prefix=self.job_attachment_settings.partial_manifest_prefix(# type: ignore[union-attr]self.farm_id, self.queue_id),source_root=Path(asset_root_manifest.root_path),file_system_location_name=asset_root_manifest.file_system_location_name,progress_tracker=progress_tracker,)manifest_properties.inputManifestPath = partial_manifest_keymanifest_properties.inputManifestHash = asset_manifest_hashmanifest_properties_list.append(manifest_properties)progress_tracker.total_time = time.perf_counter() - start_timereturn (progress_tracker.get_summary_statistics(),Attachments(manifests=manifest_properties_list),)
6
48
5
284
0
1,549
1,622
1,549
self,snapshot_dir,manifests,on_snapshotting_assets
[]
tuple[SummaryStatistics, Attachments]
{"AnnAssign": 2, "Assign": 8, "Expr": 3, "For": 1, "If": 2, "Return": 1}
17
74
17
["logger.error", "JobAttachmentsError", "self._get_total_input_size_from_manifests", "ProgressTracker", "time.perf_counter", "str", "path.relative_to", "ManifestProperties", "PathFormat.get_host_path_format", "self.asset_uploader._snapshot_assets", "Path", "self.job_attachment_settings.partial_manifest_prefix", "Path", "manifest_properties_list.append", "time.perf_counter", "progress_tracker.get_summary_statistics", "Attachments"]
0
[]
The function (snapshot_assets) defined within the public class called S3AssetManager.The function start at line 1549 and ends at 1622. It contains 48 lines of code and it has a cyclomatic complexity of 6. It takes 5 parameters, represented as [1549.0] and does not return any value. It declares 17.0 functions, and It has 17.0 functions called inside which are ["logger.error", "JobAttachmentsError", "self._get_total_input_size_from_manifests", "ProgressTracker", "time.perf_counter", "str", "path.relative_to", "ManifestProperties", "PathFormat.get_host_path_format", "self.asset_uploader._snapshot_assets", "Path", "self.job_attachment_settings.partial_manifest_prefix", "Path", "manifest_properties_list.append", "time.perf_counter", "progress_tracker.get_summary_statistics", "Attachments"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
__init__
def __init__(self,asset_bucket: str,region: str,manifest_path: str,mount_point: str,os_user: str,os_env_vars: Dict[str, str],os_group: Optional[str] = None,cas_prefix: Optional[str] = None,asset_cache_path: Optional[str] = None,):self._mount_point = mount_pointself._vfs_proc = Noneself._vfs_thread = Noneself._mount_temp_directory = Noneself._run_path = Noneself._asset_bucket = asset_bucketself._region = regionself._manifest_path = manifest_pathself._os_user = os_userself._os_group = os_groupself._os_env_vars = os_env_varsself._cas_prefix = cas_prefixself._asset_cache_path = asset_cache_path
1
25
10
127
0
64
88
64
self,asset_bucket,region,manifest_path,mount_point,os_user,os_env_vars,os_group,cas_prefix,asset_cache_path
[]
None
{"Assign": 13}
0
25
0
[]
4,993
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16379211_lorcalhost_btb_manager_telegram.btb_manager_telegram.logging_py.LoggerHandler.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16379211_lorcalhost_btb_manager_telegram.btb_manager_telegram.schedule_py.TgScheduler.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.CalculatedAmountDiscrepancyError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.ExchangeRateMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.InvalidTransactionError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.ParsingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.PriceMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.QuantityNotPositiveError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.SymbolMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.UnexpectedColumnCountError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.UnexpectedRowCountError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.raw_py.RawTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.schwab_equity_award_json_py.SchwabTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.schwab_py.SchwabTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.trading212_py.Trading212Transaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.vanguard_py.VanguardTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.ExporterError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.FritzPasswordFileDoesNotExistError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.FritzPasswordTooLongError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.DeviceInfo.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HomeAutomation.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HostInfo.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HostNumberOfEntries.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.LanInterfaceConfig.__init__"]
The function (__init__) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 64 and ends at 88. It contains 25 lines of code and it has a cyclomatic complexity of 1. It takes 10 parameters, represented as [64.0] and does not return any value. It has 4993.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16379211_lorcalhost_btb_manager_telegram.btb_manager_telegram.logging_py.LoggerHandler.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16379211_lorcalhost_btb_manager_telegram.btb_manager_telegram.schedule_py.TgScheduler.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.CalculatedAmountDiscrepancyError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.ExchangeRateMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.InvalidTransactionError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.ParsingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.PriceMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.QuantityNotPositiveError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.SymbolMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.UnexpectedColumnCountError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.UnexpectedRowCountError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.raw_py.RawTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.schwab_equity_award_json_py.SchwabTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.schwab_py.SchwabTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.trading212_py.Trading212Transaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.vanguard_py.VanguardTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.ExporterError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.FritzPasswordFileDoesNotExistError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.FritzPasswordTooLongError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.DeviceInfo.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HomeAutomation.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HostInfo.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HostNumberOfEntries.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.LanInterfaceConfig.__init__"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
kill_all_processes
def kill_all_processes(cls, session_dir: Path, os_user: str) -> None:"""Kill all existing VFS processes when outputs have been uploaded.:param session_dir: tmp directory for session:param os_user: the user running the job."""log.info("Terminating all VFS processes.")try:pid_file_path = (session_dir / DEADLINE_VFS_PID_FILE_NAME).resolve()with open(pid_file_path, "r") as file:for line in file.readlines():line = line.strip()mount_point, _, _ = line.split(":")cls.shutdown_libfuse_mount(mount_point, os_user, session_dir)os.remove(pid_file_path)except FileNotFoundError:log.warning(f"VFS pid file not found at {pid_file_path}")
3
12
3
99
0
91
107
91
cls,session_dir,os_user
[]
None
{"Assign": 3, "Expr": 5, "For": 1, "Try": 1, "With": 1}
9
17
9
["log.info", "resolve", "open", "file.readlines", "line.strip", "line.split", "cls.shutdown_libfuse_mount", "os.remove", "log.warning"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync.cleanup_session", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.test_vfs_py.TestVFSProcessmanager.test_pids_file_behavior", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.test_vfs_py.TestVFSProcessmanager.test_pids_recorded_and_killed"]
The function (kill_all_processes) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 91 and ends at 107. It contains 12 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [91.0] and does not return any value. It declares 9.0 functions, It has 9.0 functions called inside which are ["log.info", "resolve", "open", "file.readlines", "line.strip", "line.split", "cls.shutdown_libfuse_mount", "os.remove", "log.warning"], It has 3.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync.cleanup_session", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.test_vfs_py.TestVFSProcessmanager.test_pids_file_behavior", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.test_vfs_py.TestVFSProcessmanager.test_pids_recorded_and_killed"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
get_shutdown_args
def get_shutdown_args(cls, mount_path: str, os_user: str):"""Return the argument list to provide the subprocess run command to shut down the mount:param mount_path: path to mounted folder:param os_user: the user running the job."""fusermount3_path = os.path.join(cls.find_vfs_link_dir(), "fusermount3")if not os.path.exists(fusermount3_path):log.warning(f"fusermount3 not found at {cls.find_vfs_link_dir()}")return Nonereturn ["sudo", "-u", os_user, fusermount3_path, "-u", mount_path]
2
6
3
64
0
110
120
110
cls,mount_path,os_user
[]
Returns
{"Assign": 1, "Expr": 2, "If": 1, "Return": 2}
5
11
5
["os.path.join", "cls.find_vfs_link_dir", "os.path.exists", "log.warning", "cls.find_vfs_link_dir"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.test_vfs_py.TestVFSProcessmanager.test_pids_file_behavior", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.test_vfs_py.TestVFSProcessmanager.test_pids_recorded_and_killed"]
The function (get_shutdown_args) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 110 and ends at 120. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [110.0], and this function return a value. It declares 5.0 functions, It has 5.0 functions called inside which are ["os.path.join", "cls.find_vfs_link_dir", "os.path.exists", "log.warning", "cls.find_vfs_link_dir"], It has 2.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.test_vfs_py.TestVFSProcessmanager.test_pids_file_behavior", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.test_vfs_py.TestVFSProcessmanager.test_pids_recorded_and_killed"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
shutdown_libfuse_mount
def shutdown_libfuse_mount(cls, mount_path: str, os_user: str, session_dir: Path) -> bool:"""Shut down the mount at the provided path using the fusermount3 unmount optionas the provided user:param mount_path: path to mounted folder"""log.info(f"Attempting to shut down {mount_path} as {os_user}")shutdown_args = cls.get_shutdown_args(mount_path, os_user)if not shutdown_args:return Falsetry:run_result = subprocess.run(shutdown_args, check=True)except subprocess.CalledProcessError as e:log.warning(f"Shutdown failed with error {e}")# Don't reraise, check if mount is gonelog.info(f"Shutdown returns {run_result.returncode}")return cls.wait_for_mount(mount_path, session_dir, expected=False)
3
11
4
91
0
123
139
123
cls,mount_path,os_user,session_dir
[]
bool
{"Assign": 2, "Expr": 4, "If": 1, "Return": 2, "Try": 1}
6
17
6
["log.info", "cls.get_shutdown_args", "subprocess.run", "log.warning", "log.info", "cls.wait_for_mount"]
0
[]
The function (shutdown_libfuse_mount) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 123 and ends at 139. It contains 11 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [123.0] and does not return any value. It declares 6.0 functions, and It has 6.0 functions called inside which are ["log.info", "cls.get_shutdown_args", "subprocess.run", "log.warning", "log.info", "cls.wait_for_mount"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
kill_process_at_mount
def kill_process_at_mount(cls, session_dir: Path, mount_point: str, os_user: str) -> bool:"""Kill the VFS instance running at the given mount_point and modify the VFS pid trackingfile to remove the entry.:param session_dir: tmp directory for session:param mount_point: local directory to search for:param os_user: user to attempt shut down as"""if not cls.is_mount(mount_point):log.info(f"{mount_point} is not a mount, returning")return Falselog.info(f"Terminating deadline_vfs processes at {mount_point}.")mount_point_found: bool = Falsetry:pid_file_path = (session_dir / DEADLINE_VFS_PID_FILE_NAME).resolve()with open(pid_file_path, "r") as file:lines = file.readlines()with open(pid_file_path, "w") as file:for line in lines:line = line.strip()if mount_point_found:file.write(line)else:mount_for_pid, _, _ = line.split(":")if mount_for_pid == mount_point:cls.shutdown_libfuse_mount(mount_point, os_user, session_dir)mount_point_found = Trueelse:file.write(line)except FileNotFoundError:log.warning(f"VFS pid file not found at {pid_file_path}")return Falsereturn mount_point_found
6
26
4
165
0
142
176
142
cls,session_dir,mount_point,os_user
[]
bool
{"AnnAssign": 1, "Assign": 5, "Expr": 7, "For": 1, "If": 3, "Return": 3, "Try": 1, "With": 2}
13
35
13
["cls.is_mount", "log.info", "log.info", "resolve", "open", "file.readlines", "open", "line.strip", "file.write", "line.split", "cls.shutdown_libfuse_mount", "file.write", "log.warning"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py.handle_existing_vfs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.test_vfs_py.TestVFSProcessmanager.test_pids_file_behavior"]
The function (kill_process_at_mount) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 142 and ends at 176. It contains 26 lines of code and it has a cyclomatic complexity of 6. It takes 4 parameters, represented as [142.0] and does not return any value. It declares 13.0 functions, It has 13.0 functions called inside which are ["cls.is_mount", "log.info", "log.info", "resolve", "open", "file.readlines", "open", "line.strip", "file.write", "line.split", "cls.shutdown_libfuse_mount", "file.write", "log.warning"], It has 2.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py.handle_existing_vfs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.test_vfs_py.TestVFSProcessmanager.test_pids_file_behavior"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
get_manifest_path_for_mount
def get_manifest_path_for_mount(cls, session_dir: Path, mount_point: str) -> Optional[Path]:"""Given a mount_point this searches the pid file for the associated manifest path.:param session_dir: tmp directory for session:param mount_point: local directory associated with the desired manifest:returns: Path to the manifest file for mount if there is one"""try:pid_file_path = (session_dir / DEADLINE_VFS_PID_FILE_NAME).resolve()with open(pid_file_path, "r") as file:for line in file.readlines():line = line.strip()mount_for_pid, _, manifest_path = line.split(":")if mount_for_pid == mount_point:if os.path.exists(manifest_path):return Path(manifest_path)else:log.warning(f"Expected VFS input manifest at {manifest_path}")return Noneexcept FileNotFoundError:log.warning(f"VFS pid file not found at {pid_file_path}")log.warning(f"No manifest found for mount {mount_point}")return None
5
17
3
120
0
179
204
179
cls,session_dir,mount_point
[]
Optional[Path]
{"Assign": 3, "Expr": 4, "For": 1, "If": 2, "Return": 3, "Try": 1, "With": 1}
10
26
10
["resolve", "open", "file.readlines", "line.strip", "line.split", "os.path.exists", "Path", "log.warning", "log.warning", "log.warning"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py.handle_existing_vfs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.test_vfs_py.TestVFSProcessmanager.test_pids_file_behavior"]
The function (get_manifest_path_for_mount) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 179 and ends at 204. It contains 17 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [179.0] and does not return any value. It declares 10.0 functions, It has 10.0 functions called inside which are ["resolve", "open", "file.readlines", "line.strip", "line.split", "os.path.exists", "Path", "log.warning", "log.warning", "log.warning"], It has 2.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py.handle_existing_vfs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.test_vfs_py.TestVFSProcessmanager.test_pids_file_behavior"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
is_mount
def is_mount(cls, path) -> bool:"""os.path.ismount returns false for libfuse mounts owned by "other users",use findmnt instead"""return subprocess.run(["findmnt", path]).returncode == 0
1
2
2
25
0
207
212
207
cls,path
[]
bool
{"Expr": 1, "Return": 1}
1
6
1
["subprocess.run"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py.handle_existing_vfs"]
The function (is_mount) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 207 and ends at 212. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [207.0] and does not return any value. It declare 1.0 function, It has 1.0 function called inside which is ["subprocess.run"], It has 1.0 function calling this function which is ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py.handle_existing_vfs"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
wait_for_mount
def wait_for_mount(cls, mount_path, session_dir, mount_wait_seconds=60, expected=True) -> bool:"""After we've launched the VFS subprocess we need to waitfor the OS to validate that the mount is in place before use:param mount_path: Path to mount to watch for:param session_dir: Session folder associated with mount:param mount_wait_seconds: Duration to wait for mount state:param expected: Wait for the mount to exist or no longer exist"""log.info(f"Waiting for is_mount at {mount_path} to return {expected}..")wait_seconds = mount_wait_secondswhile wait_seconds >= 0:if cls.is_mount(mount_path) == expected:log.info(f"is_mount on {mount_path} returns {expected}, returning")return Truewait_seconds -= 1if wait_seconds >= 0:log.info(f"is_mount on {mount_path} not {expected}, sleeping...")time.sleep(1)log.info(f"Failed to find is_mount {expected} at {mount_path} after {mount_wait_seconds}")cls.print_log_end(session_dir)return False
4
14
5
90
0
215
236
215
cls,mount_path,session_dir,mount_wait_seconds,expected
[]
bool
{"Assign": 1, "AugAssign": 1, "Expr": 7, "If": 2, "Return": 2, "While": 1}
7
22
7
["log.info", "cls.is_mount", "log.info", "log.info", "time.sleep", "log.info", "cls.print_log_end"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.vfs_py.VFSProcessManager.start"]
The function (wait_for_mount) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 215 and ends at 236. It contains 14 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [215.0] and does not return any value. It declares 7.0 functions, It has 7.0 functions called inside which are ["log.info", "cls.is_mount", "log.info", "log.info", "time.sleep", "log.info", "cls.print_log_end"], It has 1.0 function calling this function which is ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.vfs_py.VFSProcessManager.start"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
logs_folder_path
def logs_folder_path(cls, session_dir: Path) -> Union[os.PathLike, str]:"""Find the folder we expect VFS logs to be written to"""return session_dir / VFS_LOGS_FOLDER_IN_SESSION
1
2
2
23
0
239
243
239
cls,session_dir
[]
Union[os.PathLike, str]
{"Expr": 1, "Return": 1}
0
5
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.test_vfs_py.test_vfs_has_expected_logs_folder"]
The function (logs_folder_path) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 239 and ends at 243. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [239.0] and does not return any value. It has 1.0 function calling this function which is ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.test_vfs_py.test_vfs_has_expected_logs_folder"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
get_logs_folder
def get_logs_folder(self) -> Union[os.PathLike, str]:"""Find the folder we expect VFS logs to be written to"""if self._run_path:return self.logs_folder_path(Path(self._run_path))raise VFSRunPathNotSetError("Attempted to find logs folder without run path")
2
4
1
37
0
245
251
245
self
[]
Union[os.PathLike, str]
{"Expr": 1, "If": 1, "Return": 1}
3
7
3
["self.logs_folder_path", "Path", "VFSRunPathNotSetError"]
0
[]
The function (get_logs_folder) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 245 and ends at 251. It contains 4 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3.0 functions called inside which are ["self.logs_folder_path", "Path", "VFSRunPathNotSetError"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
print_log_end
def print_log_end(self, session_dir: Path, log_file_name="vfs_log.txt", lines=100, log_level=logging.WARNING):"""Print out the end of our VFS Log.Reads the full log file into memory.Our VFS logs are sizecapped so this is not an issue for the intended use case.:param session_dir: Session folder for mount:param log_file_name: Name of file within the logs folder to read from.Defaults to vfs_log.txt whichis our "most recent" log file.:param lines: Maximum number of lines from the end of the log to print:param log_level: Level to print logging as"""log_file_path = self.logs_folder_path(session_dir) / log_file_namelog.log(log_level, f"Printing last {lines} lines from {log_file_path}")if not os.path.exists(log_file_path):log.warning(f"No log file found at {log_file_path}")returnwith open(log_file_path, "r") as log_file:for this_line in log_file.readlines()[lines * -1 :]:log.log(log_level, this_line)
3
11
5
96
0
254
273
254
self,session_dir,log_file_name,lines,log_level
[]
None
{"Assign": 1, "Expr": 4, "For": 1, "If": 1, "Return": 1, "With": 1}
7
20
7
["self.logs_folder_path", "log.log", "os.path.exists", "log.warning", "open", "log_file.readlines", "log.log"]
0
[]
The function (print_log_end) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 254 and ends at 273. It contains 11 lines of code and it has a cyclomatic complexity of 3. It takes 5 parameters, represented as [254.0] and does not return any value. It declares 7.0 functions, and It has 7.0 functions called inside which are ["self.logs_folder_path", "log.log", "os.path.exists", "log.warning", "open", "log_file.readlines", "log.log"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
find_vfs_link_dir
def find_vfs_link_dir(cls) -> str:"""Get the path where links to any necessary executables which should be added to the path should live:returns: Path to the link folder"""return os.path.join(os.path.dirname(VFSProcessManager.find_vfs()), "..", "link")
1
2
1
32
0
276
281
276
cls
[]
str
{"Expr": 1, "Return": 1}
3
6
3
["os.path.join", "os.path.dirname", "VFSProcessManager.find_vfs"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.vfs_py.VFSProcessManager.get_launch_environ"]
The function (find_vfs_link_dir) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 276 and ends at 281. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, It has 3.0 functions called inside which are ["os.path.join", "os.path.dirname", "VFSProcessManager.find_vfs"], It has 1.0 function calling this function which is ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.vfs_py.VFSProcessManager.get_launch_environ"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
build_launch_command
def build_launch_command(self, mount_point: Union[os.PathLike, str]) -> str:"""Build command to pass to Popen to launch VFS:param mount_point: directory to mount which must be the first parameter seen by our executable:return: command"""executable = VFSProcessManager.find_vfs_launch_script()command = (f"sudo -E -u {self._os_user}"f" {executable} {mount_point} -f --clienttype=deadline"f" --bucket={self._asset_bucket}"f" --manifest={self._manifest_path}"f" --region={self._region}"f" -oallow_other")if self._cas_prefix is not None:command += f" --casprefix={self._cas_prefix}"if self._asset_cache_path is not None:command += f" --cachedir={self._asset_cache_path}"log.info(f"Got launch command {command}")return command
3
16
2
75
0
283
305
283
self,mount_point
[]
str
{"Assign": 2, "AugAssign": 2, "Expr": 2, "If": 2, "Return": 1}
2
23
2
["VFSProcessManager.find_vfs_launch_script", "log.info"]
0
[]
The function (build_launch_command) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 283 and ends at 305. It contains 16 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [283.0] and does not return any value. It declares 2.0 functions, and It has 2.0 functions called inside which are ["VFSProcessManager.find_vfs_launch_script", "log.info"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
find_vfs_launch_script
def find_vfs_launch_script(cls) -> Union[os.PathLike, str]:"""Determine where the VFS launch script lives so we can build the launch command:return: Path to VFS launch script"""if VFSProcessManager.launch_script_path is not None:log.info(f"Using saved path {VFSProcessManager.launch_script_path} for launch script")return VFSProcessManager.launch_script_pathexe = DEADLINE_VFS_EXECUTABLE# for exe in executables:log.info(f"Searching for {exe} launch script")exe_script = DEADLINE_VFS_EXECUTABLE_SCRIPT# Look for env var to construct script pathif DEADLINE_VFS_ENV_VAR in os.environ:log.info(f"{DEADLINE_VFS_ENV_VAR} found in environment")environ_check = os.environ[DEADLINE_VFS_ENV_VAR] + exe_scriptelse:log.warning(f"{DEADLINE_VFS_ENV_VAR} not found in environment")environ_check = DEADLINE_VFS_INSTALL_PATH + exe_script# Test if script path existsif os.path.exists(environ_check):log.info(f"Environ check found {exe} launch script at {environ_check}")VFSProcessManager.launch_script_path = environ_checkreturn environ_check# type: ignore[return-value]else:log.error(f"Failed to find {exe} launch script!")log.error("Failed to find both executables scripts!")raise VFSLaunchScriptMissingError
4
21
1
126
0
308
337
308
cls
[]
Union[os.PathLike, str]
{"Assign": 5, "Expr": 8, "If": 3, "Return": 2}
8
30
8
["log.info", "log.info", "log.info", "log.warning", "os.path.exists", "log.info", "log.error", "log.error"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.vfs_py.VFSProcessManager.build_launch_command"]
The function (find_vfs_launch_script) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 308 and ends at 337. It contains 21 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value. It declares 8.0 functions, It has 8.0 functions called inside which are ["log.info", "log.info", "log.info", "log.warning", "os.path.exists", "log.info", "log.error", "log.error"], It has 1.0 function calling this function which is ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.vfs_py.VFSProcessManager.build_launch_command"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
find_vfs
def find_vfs(cls) -> Union[os.PathLike, str]:"""Determine where the VFS executable we'll be launching lives so we canfind the correct relative paths around it for LD_LIBRARY_PATH and config files:return: Path to VFS executable"""if VFSProcessManager.exe_path is not None:log.info(f"Using saved path {VFSProcessManager.exe_path}")return VFSProcessManager.exe_pathexe = DEADLINE_VFS_EXECUTABLE# Use "which deadline_vfs" by default to find the executable locationfound_path = shutil.which(exe)if found_path is None:log.info(f"Cwd when finding {exe} is {os.getcwd()}")# If VFS executable isn't on the PATH, check if environment variable is setif DEADLINE_VFS_ENV_VAR in os.environ:log.info(f"{DEADLINE_VFS_ENV_VAR} set to {os.environ[DEADLINE_VFS_ENV_VAR]}")environ_check = os.environ[DEADLINE_VFS_ENV_VAR] + f"/bin/{exe}"else:log.info(f"{DEADLINE_VFS_ENV_VAR} env var not set")environ_check = DEADLINE_VFS_INSTALL_PATH + f"/bin/{exe}"if os.path.exists(environ_check):log.info(f"Environ check found {exe} at {environ_check}")found_path = environ_checkelse:# Last attempt looks for deadline_vfs in binbin_check = os.path.join(os.getcwd(), f"bin/{exe}")if os.path.exists(bin_check):log.info(f"Bin check found VFS at {bin_check}")found_path = bin_checkelse:log.error(f"Failed to find {exe}!")# Run final check to see if exe path was foundif found_path is not None:log.info(f"Found {exe} at {found_path}")VFSProcessManager.exe_path = found_pathreturn found_path# type: ignore[return-value]log.error("Failed to find both executables!")raise VFSExecutableMissingError
7
30
1
193
0
340
381
340
cls
[]
Union[os.PathLike, str]
{"Assign": 8, "Expr": 10, "If": 6, "Return": 2}
15
42
15
["log.info", "shutil.which", "log.info", "os.getcwd", "log.info", "log.info", "os.path.exists", "log.info", "os.path.join", "os.getcwd", "os.path.exists", "log.info", "log.error", "log.info", "log.error"]
6
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync._launch_vfs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync.cleanup_session", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync.sync_inputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.vfs_py.VFSProcessManager.find_vfs_link_dir", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.vfs_py.VFSProcessManager.get_cwd", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.vfs_py.VFSProcessManager.get_library_path"]
The function (find_vfs) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 340 and ends at 381. It contains 30 lines of code and it has a cyclomatic complexity of 7. The function does not take any parameters and does not return any value. It declares 15.0 functions, It has 15.0 functions called inside which are ["log.info", "shutil.which", "log.info", "os.getcwd", "log.info", "log.info", "os.path.exists", "log.info", "os.path.join", "os.getcwd", "os.path.exists", "log.info", "log.error", "log.info", "log.error"], It has 6.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync._launch_vfs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync.cleanup_session", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync.sync_inputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.vfs_py.VFSProcessManager.find_vfs_link_dir", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.vfs_py.VFSProcessManager.get_cwd", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.vfs_py.VFSProcessManager.get_library_path"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
get_library_path
def get_library_path(cls) -> Union[os.PathLike, str]:"""Find our library dependencies which should be at ../lib relative to our executable"""if VFSProcessManager.library_path is None:exe_path = VFSProcessManager.find_vfs()VFSProcessManager.library_path = os.path.normpath(os.path.join(os.path.dirname(exe_path), "../lib"))log.info(f"Using library path {VFSProcessManager.library_path}")return VFSProcessManager.library_path
2
8
1
68
0
384
394
384
cls
[]
Union[os.PathLike, str]
{"Assign": 2, "Expr": 2, "If": 1, "Return": 1}
5
11
5
["VFSProcessManager.find_vfs", "os.path.normpath", "os.path.join", "os.path.dirname", "log.info"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.vfs_py.VFSProcessManager.get_launch_environ"]
The function (get_library_path) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 384 and ends at 394. It contains 8 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 5.0 functions, It has 5.0 functions called inside which are ["VFSProcessManager.find_vfs", "os.path.normpath", "os.path.join", "os.path.dirname", "log.info"], It has 1.0 function calling this function which is ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.vfs_py.VFSProcessManager.get_launch_environ"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
get_file_path
def get_file_path(self, relative_file_name: str) -> Union[os.PathLike, str]:return os.path.join(self._mount_point, relative_file_name)
1
2
2
31
0
396
397
396
self,relative_file_name
[]
Union[os.PathLike, str]
{"Return": 1}
1
2
1
["os.path.join"]
0
[]
The function (get_file_path) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 396 and ends at 397. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [396.0] and does not return any value. It declare 1.0 function, and It has 1.0 function called inside which is ["os.path.join"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
create_mount_point
def create_mount_point(cls, mount_point: Union[os.PathLike, str]) -> None:"""By default fuse won't create our mount folder, create it if it doesn't exist"""if os.path.exists(mount_point) is False:log.info(f"Creating mount point at {mount_point}")os.makedirs(mount_point, exist_ok=True)log.info(f"Modifying permissions of mount point at {mount_point}")os.chmod(path=mount_point, mode=0o777)
2
6
2
67
0
400
408
400
cls,mount_point
[]
None
{"Expr": 5, "If": 1}
5
9
5
["os.path.exists", "log.info", "os.makedirs", "log.info", "os.chmod"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.vfs_py.VFSProcessManager.start"]
The function (create_mount_point) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 400 and ends at 408. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [400.0] and does not return any value. It declares 5.0 functions, It has 5.0 functions called inside which are ["os.path.exists", "log.info", "os.makedirs", "log.info", "os.chmod"], It has 1.0 function calling this function which is ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.vfs_py.VFSProcessManager.start"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
get_cwd
def get_cwd(cls) -> Union[os.PathLike, str]:"""Determine the cwd we should hand to Popen.We expect a config/logging.ini file to exist relative to this folder."""if VFSProcessManager.cwd_path is None:exe_path = VFSProcessManager.find_vfs()# Use cwd one folder up from binVFSProcessManager.cwd_path = os.path.normpath(os.path.join(os.path.dirname(exe_path), ".."))return VFSProcessManager.cwd_path
2
7
1
61
0
411
422
411
cls
[]
Union[os.PathLike, str]
{"Assign": 2, "Expr": 1, "If": 1, "Return": 1}
4
12
4
["VFSProcessManager.find_vfs", "os.path.normpath", "os.path.join", "os.path.dirname"]
0
[]
The function (get_cwd) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 411 and ends at 422. It contains 7 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 4.0 functions, and It has 4.0 functions called inside which are ["VFSProcessManager.find_vfs", "os.path.normpath", "os.path.join", "os.path.dirname"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
get_launch_environ
def get_launch_environ(self) -> dict:"""Get the environment variables we'll pass to the launch command.:returns: dictionary of default environment variables with VFS changes applied"""my_env = {**self._os_env_vars}my_env["PATH"] = f"{VFSProcessManager.find_vfs_link_dir()}{os.pathsep}{os.environ['PATH']}"my_env["LD_LIBRARY_PATH"] = VFSProcessManager.get_library_path()# type: ignore[assignment]if os.environ.get(DEADLINE_VFS_CACHE_ENV_VAR) is not None:my_env[DEADLINE_VFS_CACHE_ENV_VAR] = os.environ.get(DEADLINE_VFS_CACHE_ENV_VAR)# type: ignore[assignment]return my_env
2
7
1
61
0
424
435
424
self
[]
dict
{"Assign": 4, "Expr": 1, "If": 1, "Return": 1}
4
12
4
["VFSProcessManager.find_vfs_link_dir", "VFSProcessManager.get_library_path", "os.environ.get", "os.environ.get"]
0
[]
The function (get_launch_environ) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 424 and ends at 435. It contains 7 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 4.0 functions, and It has 4.0 functions called inside which are ["VFSProcessManager.find_vfs_link_dir", "VFSProcessManager.get_library_path", "os.environ.get", "os.environ.get"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
set_manifest_owner
def set_manifest_owner(self) -> None:"""Set the manifest path to be owned by _os_user"""log.info(f"Attempting to set group ownership on {self._manifest_path} for {self._os_user} to {self._os_group}")if not os.path.exists(self._manifest_path):log.error(f"Manifest not found at {self._manifest_path}")returnif self._os_group is not None:try:shutil.chown(self._manifest_path, group=self._os_group)os.chmod(self._manifest_path, DEADLINE_MANIFEST_GROUP_READ_PERMS)except OSError as e:log.error(f"Failed to set ownership with error {e}")raise
4
14
1
83
0
437
453
437
self
[]
None
{"Expr": 6, "If": 2, "Return": 1, "Try": 1}
6
17
6
["log.info", "os.path.exists", "log.error", "shutil.chown", "os.chmod", "log.error"]
0
[]
The function (set_manifest_owner) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 437 and ends at 453. It contains 14 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value. It declares 6.0 functions, and It has 6.0 functions called inside which are ["log.info", "os.path.exists", "log.error", "shutil.chown", "os.chmod", "log.error"].
aws-deadline_deadline-cloud
public
public
0
0
start.read_output_thread
def read_output_thread(pipe, log):# Runs in a thread to redirect VFS output into our logtry:for line in pipe:log.info(line.decode("utf-8").strip())except Exception:log.exception("Error reading VFS output")
3
6
2
38
0
473
479
473
null
[]
None
null
0
0
0
null
0
null
The function (start.read_output_thread) defined within the public class called public.The function start at line 473 and ends at 479. It contains 6 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [473.0] and does not return any value..
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
start
def start(self, session_dir: Path) -> None:"""Start our VFS process:return: VFS process id"""self._run_path = session_dirlog.info(f"Using run_path {self._run_path}")log.info(f"Using mount_point {self._mount_point}")self.set_manifest_owner()VFSProcessManager.create_mount_point(self._mount_point)start_command = self.build_launch_command(self._mount_point)launch_env = self.get_launch_environ()log.info(f"Launching VFS with command {start_command}")log.info(f"Launching with environment {launch_env}")log.info(f"Launching as user {self._os_user}")try:def read_output_thread(pipe, log):# Runs in a thread to redirect VFS output into our logtry:for line in pipe:log.info(line.decode("utf-8").strip())except Exception:log.exception("Error reading VFS output")self._vfs_proc = subprocess.Popen(args=start_command,stdout=subprocess.PIPE,# Create a new pipestderr=subprocess.STDOUT,# Merge stderr into the stdout pipecwd=str(self._run_path),env=launch_env,shell=True,executable="/bin/bash",)self._vfs_thread = threading.Thread(target=read_output_thread, args=[self._vfs_proc.stdout, log], daemon=True)self._vfs_thread.start()except Exception as e:log.exception(f"Exception during launch with command {start_command} exception {e}")raise elog.info(f"Launched VFS as pid {self._vfs_proc.pid}")if not VFSProcessManager.wait_for_mount(self.get_mount_point(), session_dir):log.error("Failed to mount, shutting down")raise VFSFailedToMountErrortry:# if the pid file exists, add the new VFS instance and remove any it replacedpid_file_path = (session_dir / DEADLINE_VFS_PID_FILE_NAME).resolve()with open(pid_file_path, "r") as file:lines = file.readlines()with open(pid_file_path, "w") as file:file.write(f"{self._mount_point}:{self._vfs_proc.pid}:{self._manifest_path}\n")for line in lines:line = line.strip()entry_mount_point, entry_pid, entry_manifest_path = line.split(":")if self._mount_point != entry_mount_point:file.write(f"{line}\n")else:log.warning(f"Pid {entry_pid} entry not removed at {entry_mount_point}")except FileNotFoundError:# if the pid file doesn't exist, this will create itwith open(pid_file_path, "a") as file:file.write(f"{self._mount_point}:{self._vfs_proc.pid}:{self._manifest_path}")
6
49
2
325
0
455
521
455
self,session_dir
[]
None
{"Assign": 9, "Expr": 18, "For": 2, "If": 2, "Try": 3, "With": 3}
33
67
33
["log.info", "log.info", "self.set_manifest_owner", "VFSProcessManager.create_mount_point", "self.build_launch_command", "self.get_launch_environ", "log.info", "log.info", "log.info", "log.info", "strip", "line.decode", "log.exception", "subprocess.Popen", "str", "threading.Thread", "self._vfs_thread.start", "log.exception", "log.info", "VFSProcessManager.wait_for_mount", "self.get_mount_point", "log.error", "resolve", "open", "file.readlines", "open", "file.write", "line.strip", "line.split", "file.write", "log.warning", "open", "file.write"]
142
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3527343_frigg_frigg_hq.frigg.projects.views_py.approve_projects", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3549150_freenas_cli.freenas.cli.functions_py.setinterval", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3574420_guillermooo_vintageous.test_runner_py.RunVintageousTests.run", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3656399_avelino_liquidluck.liquidluck.tools.server_py.LiveReloadHandler.on_message", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3656399_avelino_liquidluck.liquidluck.tools.server_py.start_server", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3659719_hupili_snsapi.snsapi.async_py.AsyncDaemonWithCallBack._start", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3659719_hupili_snsapi.snsapi.async_py.AsynchronousWithCallBack._call_", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3664958_ldtp_ldtp2.ldtpd.core_py.Ldtpd.startprocessmonitor", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3667502_braver_sidebartools.SideBar_py.SideBarDuplicateCommand.on_done", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3667502_braver_sidebartools.SideBar_py.SideBarMoveCommand.on_done", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3667502_braver_sidebartools.SideBar_py.SideBarNewCommand.on_done", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3683022_datamill_co_target_postgres.target_postgres.target_tools_py._async_send_usage_stats", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3692282_archiveteam_terroroftinytown.terroroftinytown.release.baseuploader_py.BaseUploaderBootstrap.start", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3692282_archiveteam_terroroftinytown.terroroftinytown.release.undrain_recovery_py.UndrainBootstrap.start", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3692282_archiveteam_terroroftinytown.terroroftinytown.test.random_result_py.MockProject.start", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3692282_archiveteam_terroroftinytown.terroroftinytown.test.random_result_py.MockResult.start", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3692282_archiveteam_terroroftinytown.terroroftinytown.tracker.backup_py.BackupBootstrap.start", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3692282_archiveteam_terroroftinytown.terroroftinytown.tracker.bootstrap_py.ApplicationBootstrap.boot", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3692282_archiveteam_terroroftinytown.terroroftinytown.tracker.bootstrap_py.ApplicationBootstrap.start", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3692282_archiveteam_terroroftinytown.terroroftinytown.tracker.export_py.ExporterBootstrap.start", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3707902_apenwarr_redo.redo.builder_py.run", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3716832_openstack_ovsdbapp.ovsdbapp.tests.functional.schema.open_vswitch.test_impl_idl_py.ImplIdlTestCase.setUp", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3716832_openstack_ovsdbapp.ovsdbapp.tests.functional.schema.open_vswitch.test_impl_idl_py.ImplIdlTestCase.test_post_commit_vswitchd_incomplete_timeout", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3716832_openstack_ovsdbapp.ovsdbapp.tests.unit.test_api_py.TestingAPI.create_transaction", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3720482_torproject_chutney.lib.chutney.TorNet_py.Network.start"]
The function (start) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 455 and ends at 521. It contains 49 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [455.0] and does not return any value. It declares 33.0 functions, It has 33.0 functions called inside which are ["log.info", "log.info", "self.set_manifest_owner", "VFSProcessManager.create_mount_point", "self.build_launch_command", "self.get_launch_environ", "log.info", "log.info", "log.info", "log.info", "strip", "line.decode", "log.exception", "subprocess.Popen", "str", "threading.Thread", "self._vfs_thread.start", "log.exception", "log.info", "VFSProcessManager.wait_for_mount", "self.get_mount_point", "log.error", "resolve", "open", "file.readlines", "open", "file.write", "line.strip", "line.split", "file.write", "log.warning", "open", "file.write"], It has 142.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3527343_frigg_frigg_hq.frigg.projects.views_py.approve_projects", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3549150_freenas_cli.freenas.cli.functions_py.setinterval", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3574420_guillermooo_vintageous.test_runner_py.RunVintageousTests.run", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3656399_avelino_liquidluck.liquidluck.tools.server_py.LiveReloadHandler.on_message", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3656399_avelino_liquidluck.liquidluck.tools.server_py.start_server", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3659719_hupili_snsapi.snsapi.async_py.AsyncDaemonWithCallBack._start", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3659719_hupili_snsapi.snsapi.async_py.AsynchronousWithCallBack._call_", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3664958_ldtp_ldtp2.ldtpd.core_py.Ldtpd.startprocessmonitor", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3667502_braver_sidebartools.SideBar_py.SideBarDuplicateCommand.on_done", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3667502_braver_sidebartools.SideBar_py.SideBarMoveCommand.on_done", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3667502_braver_sidebartools.SideBar_py.SideBarNewCommand.on_done", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3683022_datamill_co_target_postgres.target_postgres.target_tools_py._async_send_usage_stats", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3692282_archiveteam_terroroftinytown.terroroftinytown.release.baseuploader_py.BaseUploaderBootstrap.start", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3692282_archiveteam_terroroftinytown.terroroftinytown.release.undrain_recovery_py.UndrainBootstrap.start", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3692282_archiveteam_terroroftinytown.terroroftinytown.test.random_result_py.MockProject.start", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3692282_archiveteam_terroroftinytown.terroroftinytown.test.random_result_py.MockResult.start", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3692282_archiveteam_terroroftinytown.terroroftinytown.tracker.backup_py.BackupBootstrap.start", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3692282_archiveteam_terroroftinytown.terroroftinytown.tracker.bootstrap_py.ApplicationBootstrap.boot", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3692282_archiveteam_terroroftinytown.terroroftinytown.tracker.bootstrap_py.ApplicationBootstrap.start", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3692282_archiveteam_terroroftinytown.terroroftinytown.tracker.export_py.ExporterBootstrap.start", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3707902_apenwarr_redo.redo.builder_py.run", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3716832_openstack_ovsdbapp.ovsdbapp.tests.functional.schema.open_vswitch.test_impl_idl_py.ImplIdlTestCase.setUp", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3716832_openstack_ovsdbapp.ovsdbapp.tests.functional.schema.open_vswitch.test_impl_idl_py.ImplIdlTestCase.test_post_commit_vswitchd_incomplete_timeout", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3716832_openstack_ovsdbapp.ovsdbapp.tests.unit.test_api_py.TestingAPI.create_transaction", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3720482_torproject_chutney.lib.chutney.TorNet_py.Network.start"].
aws-deadline_deadline-cloud
VFSProcessManager
public
0
1
get_mount_point
def get_mount_point(self) -> Union[os.PathLike, str]:return self._mount_point
1
2
1
18
0
523
524
523
self
[]
Union[os.PathLike, str]
{"Return": 1}
0
2
0
[]
0
[]
The function (get_mount_point) defined within the public class called VFSProcessManager, that inherit another class.The function start at line 523 and ends at 524. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
aws-deadline_deadline-cloud
public
public
0
0
get_botocore_session
def get_botocore_session() -> botocore.session.Session:return botocore.session.get_session()
1
2
0
18
0
31
32
31
[]
botocore.session.Session
{"Return": 1}
1
2
1
["botocore.session.get_session"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py._get_queue_user_boto3_session", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_boto3_session"]
The function (get_botocore_session) defined within the public class called public.The function start at line 31 and ends at 32. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, It has 1.0 function called inside which is ["botocore.session.get_session"], It has 2.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py._get_queue_user_boto3_session", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_boto3_session"].
aws-deadline_deadline-cloud
public
public
0
0
get_boto3_session
def get_boto3_session(botocore_session: botocore.session.Session = get_botocore_session(),) -> boto3.session.Session:return boto3.session.Session(botocore_session=botocore_session)
1
4
1
33
0
36
39
36
botocore_session
[]
boto3.session.Session
{"Return": 1}
3
4
3
["get_botocore_session", "boto3.session.Session", "lru_cache"]
12
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py.check_authentication_status", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py.get_boto3_client", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py.get_credentials_source", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py.get_monitor_id", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py.get_queue_user_boto3_session", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py.get_user_and_identity_store_id", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._telemetry_py.TelemetryClient.record_event", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_deadline_client", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_s3_client", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_sts_client", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.upload_py.S3AssetUploader.__init__"]
The function (get_boto3_session) defined within the public class called public.The function start at line 36 and ends at 39. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, It has 3.0 functions called inside which are ["get_botocore_session", "boto3.session.Session", "lru_cache"], It has 12.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py.check_authentication_status", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py.get_boto3_client", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py.get_credentials_source", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py.get_monitor_id", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py.get_queue_user_boto3_session", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py.get_user_and_identity_store_id", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._telemetry_py.TelemetryClient.record_event", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_deadline_client", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_s3_client", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_sts_client", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.upload_py.S3AssetUploader.__init__"].
aws-deadline_deadline-cloud
public
public
0
0
get_deadline_client
def get_deadline_client(session: Optional[boto3.session.Session] = None, endpoint_url: Optional[str] = None) -> BaseClient:"""Get a boto3 Deadline client to make API calls to Deadline"""if session is None:session = get_boto3_session()return session.client(VENDOR_CODE, endpoint_url=endpoint_url)
2
6
2
49
1
43
52
43
session,endpoint_url
['session']
BaseClient
{"Assign": 1, "Expr": 1, "If": 1, "Return": 1}
3
10
3
["get_boto3_session", "session.client", "lru_cache"]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.deadline_py.get_job", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.deadline_py.get_queue", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.aws.test_aws_clients_py.test_get_deadline_client", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.aws.test_aws_clients_py.test_get_deadline_client_non_default_endpoint"]
The function (get_deadline_client) defined within the public class called public.The function start at line 43 and ends at 52. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [43.0] and does not return any value. It declares 3.0 functions, It has 3.0 functions called inside which are ["get_boto3_session", "session.client", "lru_cache"], It has 4.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.deadline_py.get_job", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.deadline_py.get_queue", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.aws.test_aws_clients_py.test_get_deadline_client", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.aws.test_aws_clients_py.test_get_deadline_client_non_default_endpoint"].
aws-deadline_deadline-cloud
public
public
0
0
get_s3_client.add_expected_bucket_owner
def add_expected_bucket_owner(params, model, **kwargs):"""Add the expected bucket owner to the params if the API operation to run can use it."""if "ExpectedBucketOwner" in model.input_shape.members:params["ExpectedBucketOwner"] = get_account_id(session=session)
2
3
3
31
0
78
83
78
null
[]
None
null
0
0
0
null
0
null
The function (get_s3_client.add_expected_bucket_owner) defined within the public class called public.The function start at line 78 and ends at 83. It contains 3 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [78.0] and does not return any value..
aws-deadline_deadline-cloud
public
public
0
0
get_s3_client
def get_s3_client(session: Optional[boto3.Session] = None) -> BaseClient:"""Get a boto3 S3 client to make API calls to S3"""if session is None:session = get_boto3_session()s3_max_pool_connections = get_s3_max_pool_connections()client = session.client("s3",config=Config(signature_version="s3v4",connect_timeout=S3_CONNECT_TIMEOUT_IN_SECS,read_timeout=S3_READ_TIMEOUT_IN_SECS,retries={"mode": S3_RETRIES_MODE},user_agent_extra=f"S3A/Deadline/NA/JobAttachments/{version}",max_pool_connections=s3_max_pool_connections,),endpoint_url=f"https://s3.{session.region_name}.amazonaws.com",)def add_expected_bucket_owner(params, model, **kwargs):"""Add the expected bucket owner to the params if the API operation to run can use it."""if "ExpectedBucketOwner" in model.input_shape.members:params["ExpectedBucketOwner"] = get_account_id(session=session)client.meta.events.register("provide-client-params.s3.*", add_expected_bucket_owner)return client
2
19
1
97
3
56
87
56
session
['client', 's3_max_pool_connections', 'session']
BaseClient
{"Assign": 4, "Expr": 3, "If": 2, "Return": 1}
7
32
7
["get_boto3_session", "get_s3_max_pool_connections", "session.client", "Config", "get_account_id", "client.meta.events.register", "lru_cache"]
9
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py.precache_clients", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads._manifest_s3_downloads_py._download_manifest_paths", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py._get_asset_root_and_manifest_from_s3_with_last_modified", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py._get_tasks_manifests_keys_from_s3", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py.download_file", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py.download_files", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py.download_files_from_manifests", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.upload_py.S3AssetUploader.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.aws.test_aws_clients_py.test_get_s3_client"]
The function (get_s3_client) defined within the public class called public.The function start at line 56 and ends at 87. It contains 19 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 7.0 functions, It has 7.0 functions called inside which are ["get_boto3_session", "get_s3_max_pool_connections", "session.client", "Config", "get_account_id", "client.meta.events.register", "lru_cache"], It has 9.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py.precache_clients", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads._manifest_s3_downloads_py._download_manifest_paths", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py._get_asset_root_and_manifest_from_s3_with_last_modified", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py._get_tasks_manifests_keys_from_s3", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py.download_file", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py.download_files", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py.download_files_from_manifests", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.upload_py.S3AssetUploader.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.aws.test_aws_clients_py.test_get_s3_client"].
aws-deadline_deadline-cloud
public
public
0
0
get_s3_max_pool_connections
def get_s3_max_pool_connections() -> int:try:s3_max_pool_connections = int(config_file.get_setting("settings.s3_max_pool_connections"))except ValueError as ve:raise AssetSyncError("Failed to parse configuration settings. Please ensure that the following settings in the config file are integers: ""'s3_max_pool_connections'") from veif s3_max_pool_connections <= 0:raise AssetSyncError(f"Nonvalid value for configuration setting: 's3_max_pool_connections' ({s3_max_pool_connections}) must be positive integer.")return s3_max_pool_connections
3
13
0
45
1
90
102
90
['s3_max_pool_connections']
int
{"Assign": 1, "If": 1, "Return": 1, "Try": 1}
4
13
4
["int", "config_file.get_setting", "AssetSyncError", "AssetSyncError"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_s3_client", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py._get_num_download_workers"]
The function (get_s3_max_pool_connections) defined within the public class called public.The function start at line 90 and ends at 102. It contains 13 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 4.0 functions, It has 4.0 functions called inside which are ["int", "config_file.get_setting", "AssetSyncError", "AssetSyncError"], It has 2.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_s3_client", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py._get_num_download_workers"].
aws-deadline_deadline-cloud
public
public
0
0
get_s3_transfer_manager
def get_s3_transfer_manager(s3_client: BaseClient):transfer_config = boto3.s3.transfer.TransferConfig()return create_transfer_manager(client=s3_client, config=transfer_config)
1
3
1
29
1
106
108
106
s3_client
['transfer_config']
Returns
{"Assign": 1, "Return": 1}
3
3
3
["boto3.s3.transfer.TransferConfig", "create_transfer_manager", "lru_cache"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads._manifest_s3_downloads_py._download_file_with_transfer_manager", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py.download_file", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.upload_py.S3AssetUploader.upload_file_to_s3"]
The function (get_s3_transfer_manager) defined within the public class called public.The function start at line 106 and ends at 108. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It declares 3.0 functions, It has 3.0 functions called inside which are ["boto3.s3.transfer.TransferConfig", "create_transfer_manager", "lru_cache"], It has 3.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads._manifest_s3_downloads_py._download_file_with_transfer_manager", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py.download_file", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.upload_py.S3AssetUploader.upload_file_to_s3"].
aws-deadline_deadline-cloud
public
public
0
0
get_sts_client
def get_sts_client(session: Optional[boto3.session.Session] = None) -> BaseClient:"""Get a boto3 sts client to make API calls to STS."""if session is None:session = get_boto3_session()return session.client("sts",endpoint_url=f"https://sts.{session.region_name}.amazonaws.com",)
2
7
1
42
1
112
121
112
session
['session']
BaseClient
{"Assign": 1, "Expr": 1, "If": 1, "Return": 1}
3
10
3
["get_boto3_session", "session.client", "lru_cache"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_caller_identity", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.aws.test_aws_clients_py.test_get_sts_client"]
The function (get_sts_client) defined within the public class called public.The function start at line 112 and ends at 121. It contains 7 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 3.0 functions, It has 3.0 functions called inside which are ["get_boto3_session", "session.client", "lru_cache"], It has 2.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_caller_identity", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.aws.test_aws_clients_py.test_get_sts_client"].
aws-deadline_deadline-cloud
public
public
0
0
get_caller_identity
def get_caller_identity(session: Optional[boto3.session.Session] = None) -> dict[str, str]:"""Get the caller identity for the current session."""return get_sts_client(session).get_caller_identity()
1
2
1
33
0
125
129
125
session
[]
dict[str, str]
{"Expr": 1, "Return": 1}
3
5
3
["get_caller_identity", "get_sts_client", "lru_cache"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.tsbench.src.tsbench.evaluations.aws.session_py.account_id", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py.check_authentication_status", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._telemetry_py.TelemetryClient.get_account_id", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_account_id", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_caller_identity"]
The function (get_caller_identity) defined within the public class called public.The function start at line 125 and ends at 129. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, It has 3.0 functions called inside which are ["get_caller_identity", "get_sts_client", "lru_cache"], It has 5.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.tsbench.src.tsbench.evaluations.aws.session_py.account_id", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._session_py.check_authentication_status", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.api._telemetry_py.TelemetryClient.get_account_id", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_account_id", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_caller_identity"].
aws-deadline_deadline-cloud
public
public
0
0
get_account_id
def get_account_id(session: Optional[boto3.session.Session] = None) -> str:"""Get the account id for the current session."""return get_caller_identity(session)["Account"]
1
2
1
27
0
132
136
132
session
[]
str
{"Expr": 1, "Return": 1}
1
5
1
["get_caller_identity"]
7
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_s3_client", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads._manifest_s3_downloads_py._download_file_with_get_object", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads._manifest_s3_downloads_py._download_file_with_transfer_manager", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py._get_asset_root_and_manifest_from_s3_with_last_modified", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py.download_file", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.upload_py.S3AssetUploader.file_already_uploaded", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.upload_py.S3AssetUploader.upload_bytes_to_s3"]
The function (get_account_id) defined within the public class called public.The function start at line 132 and ends at 136. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, It has 1.0 function called inside which is ["get_caller_identity"], It has 7.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.aws_clients_py.get_s3_client", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads._manifest_s3_downloads_py._download_file_with_get_object", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads._manifest_s3_downloads_py._download_file_with_transfer_manager", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py._get_asset_root_and_manifest_from_s3_with_last_modified", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.download_py.download_file", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.upload_py.S3AssetUploader.file_already_uploaded", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.upload_py.S3AssetUploader.upload_bytes_to_s3"].
aws-deadline_deadline-cloud
public
public
0
0
get_queue
def get_queue(farm_id: str,queue_id: str,session: Optional[boto3.Session] = None,deadline_endpoint_url: Optional[str] = None,) -> Queue:"""Retrieves a specific queue from AWS Deadline Cloud."""try:response = get_deadline_client(session=session, endpoint_url=deadline_endpoint_url).get_queue(farmId=farm_id, queueId=queue_id)except ClientError as exc:raise JobAttachmentsError(f'Failed to get queue "{queue_id}" from Deadline: {exc}') from exc# The API returns empty fields instead of an empty dict if there are no job attachment settings. So we need to# double check if the s3BucketName is set.if response.get("jobAttachmentSettings") and response["jobAttachmentSettings"].get("s3BucketName"):job_attachment_settings = JobAttachmentS3Settings(s3BucketName=response["jobAttachmentSettings"].get("s3BucketName", ""),rootPrefix=response["jobAttachmentSettings"].get("rootPrefix", ""),)else:job_attachment_settings = Nonedisplay_name_key = "displayName"status_key = "status"if "name" in response:display_name_key = "name"if "state" in response:status_key = "state"return Queue(displayName=response[display_name_key],queueId=response["queueId"],farmId=response["farmId"],status=response[status_key],defaultBudgetAction=response["defaultBudgetAction"],jobAttachmentSettings=job_attachment_settings,)
6
35
4
194
4
23
65
23
farm_id,queue_id,session,deadline_endpoint_url
['display_name_key', 'status_key', 'job_attachment_settings', 'response']
Queue
{"Assign": 7, "Expr": 1, "If": 3, "Return": 1, "Try": 1}
9
43
9
["get_queue", "get_deadline_client", "JobAttachmentsError", "response.get", "get", "JobAttachmentS3Settings", "get", "get", "Queue"]
29
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.scripted_tests.download_cancel_test_py.test_download_outputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.scripted_tests.download_cancel_test_py.test_sync_inputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.scripted_tests.sync_inputs_with_step_deps_py.test_sync_inputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.scripted_tests.upload_cancel_test_py.run", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._groups.attachment_group_py.attachment_download", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._groups.attachment_group_py.attachment_upload", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.deadline_py.get_queue", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync.get_s3_settings", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.cli.conftest_py.upload_input_files_assets_not_in_cas", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.cli.conftest_py.upload_input_files_one_asset_in_cas", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.cli.test_cli_manifest_upload_py.TestManifestUpload.test_manifest_upload_by_farm_queue", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.cli.test_utils_py.JobAttachmentTest.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.sync_inputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.sync_outputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_download_outputs_no_outputs_dir", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_download_outputs_windows_long_file_path", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_download_outputs_with_job_id_and_download_directory", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_download_outputs_with_job_id_step_id_and_download_directory", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_download_outputs_with_job_id_step_id_task_id_and_download_directory", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_sync_inputs_no_inputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_sync_inputs_with_step_dependencies", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_sync_outputs_with_symlink", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_upload_input_files_all_assets_in_cas", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_upload_input_files_no_download_paths", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.upload_input_files_assets_not_in_cas"]
The function (get_queue) defined within the public class called public.The function start at line 23 and ends at 65. It contains 35 lines of code and it has a cyclomatic complexity of 6. It takes 4 parameters, represented as [23.0] and does not return any value. It declares 9.0 functions, It has 9.0 functions called inside which are ["get_queue", "get_deadline_client", "JobAttachmentsError", "response.get", "get", "JobAttachmentS3Settings", "get", "get", "Queue"], It has 29.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.scripted_tests.download_cancel_test_py.test_download_outputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.scripted_tests.download_cancel_test_py.test_sync_inputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.scripted_tests.sync_inputs_with_step_deps_py.test_sync_inputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.scripted_tests.upload_cancel_test_py.run", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._groups.attachment_group_py.attachment_download", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._groups.attachment_group_py.attachment_upload", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.deadline_py.get_queue", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync.get_s3_settings", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.cli.conftest_py.upload_input_files_assets_not_in_cas", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.cli.conftest_py.upload_input_files_one_asset_in_cas", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.cli.test_cli_manifest_upload_py.TestManifestUpload.test_manifest_upload_by_farm_queue", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.cli.test_utils_py.JobAttachmentTest.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.sync_inputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.sync_outputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_download_outputs_no_outputs_dir", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_download_outputs_windows_long_file_path", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_download_outputs_with_job_id_and_download_directory", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_download_outputs_with_job_id_step_id_and_download_directory", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_download_outputs_with_job_id_step_id_task_id_and_download_directory", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_sync_inputs_no_inputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_sync_inputs_with_step_dependencies", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_sync_outputs_with_symlink", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_upload_input_files_all_assets_in_cas", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.test_upload_input_files_no_download_paths", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.deadline_job_attachments.test_job_attachments_py.upload_input_files_assets_not_in_cas"].
aws-deadline_deadline-cloud
public
public
0
0
get_job
def get_job(farm_id: str,queue_id: str,job_id: str,session: Optional[boto3.Session] = None,deadline_endpoint_url: Optional[str] = None,) -> Job:"""Retrieves a specific job from AWS Deadline Cloud."""try:response = get_deadline_client(session=session, endpoint_url=deadline_endpoint_url).get_job(farmId=farm_id, queueId=queue_id, jobId=job_id)except ClientError as exc:raise JobAttachmentsError(f'Failed to get job "{job_id}" from Deadline') from excreturn Job(jobId=response["jobId"],attachments=(Attachments(manifests=[ManifestProperties(fileSystemLocationName=manifest_properties.get("fileSystemLocationName", None),rootPath=manifest_properties["rootPath"],rootPathFormat=PathFormat(manifest_properties["rootPathFormat"]),outputRelativeDirectories=manifest_properties.get("outputRelativeDirectories", None),inputManifestPath=manifest_properties.get("inputManifestPath", None),)for manifest_properties in response["attachments"]["manifests"]],fileSystem=JobAttachmentsFileSystem(response["attachments"].get("fileSystem", JobAttachmentsFileSystem.COPIED.value)),)if "attachments" in response and response["attachments"]else None),)
5
39
5
200
1
68
109
68
farm_id,queue_id,job_id,session,deadline_endpoint_url
['response']
Job
{"Assign": 1, "Expr": 1, "Return": 1, "Try": 1}
12
42
12
["get_job", "get_deadline_client", "JobAttachmentsError", "Job", "Attachments", "ManifestProperties", "manifest_properties.get", "PathFormat", "manifest_properties.get", "manifest_properties.get", "JobAttachmentsFileSystem", "get"]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.scripted_tests.download_cancel_test_py.test_sync_inputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.scripted_tests.sync_inputs_with_step_deps_py.test_sync_inputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.deadline_py.get_job", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync.get_attachments"]
The function (get_job) defined within the public class called public.The function start at line 68 and ends at 109. It contains 39 lines of code and it has a cyclomatic complexity of 5. It takes 5 parameters, represented as [68.0] and does not return any value. It declares 12.0 functions, It has 12.0 functions called inside which are ["get_job", "get_deadline_client", "JobAttachmentsError", "Job", "Attachments", "ManifestProperties", "manifest_properties.get", "PathFormat", "manifest_properties.get", "manifest_properties.get", "JobAttachmentsFileSystem", "get"], It has 4.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.scripted_tests.download_cancel_test_py.test_sync_inputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.scripted_tests.sync_inputs_with_step_deps_py.test_sync_inputs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._aws.deadline_py.get_job", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.asset_sync_py.AssetSync.get_attachments"].
aws-deadline_deadline-cloud
public
public
0
0
_add_output_manifests_from_s3
def _add_output_manifests_from_s3(farm_id: str,queue: dict[str, Any],job: dict[str, Any],boto3_session: boto3.Session,session_action_list: list[dict[str, Any]],):"""This function takes a list of session actions (as returned by boto3 deadline.list_session_actions),and for any that lack manifest fields, updates them with values retrieved from S3. While the responsefrom Deadline Cloud will always return both outputManifestPath and outputManifestHash, this functiononly populates the outputManifestPath value. The order of the manifests in the list precisely correspondto the manifests returned by boto3 deadline.get_job, clients of these APIs can zip() the twomanifests lists together to get the full set of fields needed for processing.* https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/deadline/client/list_session_actions.html* https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/deadline/client/get_job.htmlArgs:farm_id: The farm id.queue: The queue as returned by boto3 deadline.get_queue().job: The job as returned by boto3 deadline.search_jobs().boto3_session: The boto3.Session for accessing AWS.session_action_list: A list of session actions to modify by adding the "manifests" field where necessary.Its shape is as returned by boto3 deadline.list_session_actions() or deadline.get_session_action()."""# If the job has no job attachments, there's nothing to addif "attachments" not in job:returns3_settings = JobAttachmentS3Settings(**queue["jobAttachmentSettings"])# Filter the session action list to exclude any that already contain manifests,# then return early if the result is empty.session_action_list = [session_actionfor session_action in session_action_listif "manifests" not in session_action]if not session_action_list:return# Process the job's attachments list to generate the hashesjob_manifests_length = len(job["attachments"]["manifests"])job_indexed_root_path_hash = [(index,ja_hash_data(f"{manifest.get('fileSystemLocationName', '')}{manifest['rootPath']}".encode(),DEFAULT_HASH_ALG,),)for index, manifest in enumerate(job["attachments"]["manifests"])]# Initialize to empty "manifests" entriesfor session_action in session_action_list:session_action["manifests"] = [{}] * job_manifests_length# Get all the output manifest keys for all the steps/tasks of the job.# TODO: This is very inefficient if the job has lots of tasks, because# the incremental download will generally only use a few of them at a time.manifest_prefix: str = _get_output_manifest_prefix(s3_settings, farm_id, queue["queueId"], job["jobId"])try:manifests_keys: list[str] = _get_tasks_manifests_keys_from_s3(manifest_prefix,s3_settings.s3BucketName,session=boto3_session,select_latest_per_task=False,)except JobAttachmentsError as e:# If there are no manifests, treat as no data.if str(e).startswith("Unable to find asset manifest in"):returnelse:raise# Organize the session actions by session action id, so that we can quickly get# to the correct session action from the manifest object key.session_actions_by_session_action_id: dict[str, dict[str, Any]] = {session_action["sessionActionId"]: session_action for session_action in session_action_list}manifest_prefix = f"{queue['jobAttachmentSettings']['rootPrefix']}/{S3_MANIFEST_FOLDER_NAME}/"for key in manifests_keys:# Extract the session action id from the manifest keym = SESSION_ACTION_ID_FROM_KEY_RE.search(key)if m:manifest_session_action_id = m[1]else:raise RuntimeError(f"Job attachments manifest key for job {job['name']} ({job['jobId']}) lacks a session action id")# Loop through all the manifests to see whether the hash of the rootPath is in the key,# in order to determine which position in the manifests list this key should get set in.manifests_index = Nonefor index, root_path_hash in job_indexed_root_path_hash:if root_path_hash in key:manifests_index = indexbreakif manifests_index is None:root_path_hashes = [hash for _, hash in job_indexed_root_path_hash]raise RuntimeError(f"Job attachments manifest key for job {job['name']} ({job['jobId']}) does not contain any of the rootPath hashes {', '.join(root_path_hashes)}: {key}")# If this session action is in the list, add this key to itsession_action_for_key = session_actions_by_session_action_id.get(manifest_session_action_id)if session_action_for_key is not None:# This is equivalent to "output_manifest_path = key.removeprefix(manifest_prefix)" to# retain support for Python 3.8 which does not support str.removeprefix.output_manifest_path = keyif output_manifest_path.startswith(manifest_prefix):output_manifest_path = output_manifest_path[len(manifest_prefix) :]session_action_for_key["manifests"][manifests_index] = {"outputManifestPath": output_manifest_path,}
18
77
5
361
11
81
199
81
farm_id,queue,job,boto3_session,session_action_list
['root_path_hashes', 'manifest_session_action_id', 'job_manifests_length', 'job_indexed_root_path_hash', 'session_action_for_key', 'output_manifest_path', 'm', 'session_action_list', 'manifest_prefix', 's3_settings', 'manifests_index']
None
{"AnnAssign": 3, "Assign": 15, "Expr": 1, "For": 3, "If": 8, "Return": 3, "Try": 1}
17
119
17
["JobAttachmentS3Settings", "len", "ja_hash_data", "encode", "manifest.get", "enumerate", "_get_output_manifest_prefix", "_get_tasks_manifests_keys_from_s3", "startswith", "str", "SESSION_ACTION_ID_FROM_KEY_RE.search", "RuntimeError", "RuntimeError", "join", "session_actions_by_session_action_id.get", "output_manifest_path.startswith", "len"]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._incremental_download_py._add_missing_output_manifests_to_job_sessions", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.incremental_downloads.test_add_output_manifests_from_s3_py.test_add_output_manifests_from_s3_already_stored", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.incremental_downloads.test_add_output_manifests_from_s3_py.test_add_output_manifests_from_s3_edge_cases", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.incremental_downloads.test_add_output_manifests_from_s3_py.test_add_output_manifests_from_s3_fill_in_missing_manifests"]
The function (_add_output_manifests_from_s3) defined within the public class called public.The function start at line 81 and ends at 199. It contains 77 lines of code and it has a cyclomatic complexity of 18. It takes 5 parameters, represented as [81.0] and does not return any value. It declares 17.0 functions, It has 17.0 functions called inside which are ["JobAttachmentS3Settings", "len", "ja_hash_data", "encode", "manifest.get", "enumerate", "_get_output_manifest_prefix", "_get_tasks_manifests_keys_from_s3", "startswith", "str", "SESSION_ACTION_ID_FROM_KEY_RE.search", "RuntimeError", "RuntimeError", "join", "session_actions_by_session_action_id.get", "output_manifest_path.startswith", "len"], It has 4.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._incremental_download_py._add_missing_output_manifests_to_job_sessions", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.incremental_downloads.test_add_output_manifests_from_s3_py.test_add_output_manifests_from_s3_already_stored", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.incremental_downloads.test_add_output_manifests_from_s3_py.test_add_output_manifests_from_s3_edge_cases", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.incremental_downloads.test_add_output_manifests_from_s3_py.test_add_output_manifests_from_s3_fill_in_missing_manifests"].
aws-deadline_deadline-cloud
public
public
0
0
_download_manifest_and_make_paths_absolute
def _download_manifest_and_make_paths_absolute(index: int,queue: dict[str, Any],job_id: str,root_path: str,manifest_s3_key: str,path_mapping_rule_applier: Optional[_PathMappingRuleApplier],boto3_session_for_s3: boto3.Session,output_manifests: list,output_unmapped_paths: list[tuple[str, str]],):"""Downloads the specified manifest, makes all its paths absolute using root_path,and then places it in output_manifests[index]."""# Download the manifest_, last_modified, manifest = _get_asset_root_and_manifest_from_s3_with_last_modified(manifest_s3_key, queue["jobAttachmentSettings"]["s3BucketName"], boto3_session_for_s3)if path_mapping_rule_applier:new_manifest_paths = []if path_mapping_rule_applier.source_path_format == PathFormat.WINDOWS.value:source_os_path: Any = ntpathelse:source_os_path = posixpathelse:source_os_path = os.path# Convert all the manifest paths to have absolute normalized local pathsfor manifest_path in manifest.paths:manifest_path.path = source_os_path.normpath(source_os_path.join(root_path, manifest_path.path))if path_mapping_rule_applier:try:manifest_path.path = str(path_mapping_rule_applier.strict_transform(manifest_path.path))new_manifest_paths.append(manifest_path)except ValueError:output_unmapped_paths.append((job_id, manifest_path.path))if path_mapping_rule_applier:# Update the manifest to only include the mapped pathsmanifest.paths = new_manifest_pathsoutput_manifests[index] = (last_modified, manifest)
7
37
9
199
2
202
248
202
index,queue,job_id,root_path,manifest_s3_key,path_mapping_rule_applier,boto3_session_for_s3,output_manifests,output_unmapped_paths
['source_os_path', 'new_manifest_paths']
None
{"AnnAssign": 1, "Assign": 8, "Expr": 3, "For": 1, "If": 4, "Try": 1}
7
47
7
["_get_asset_root_and_manifest_from_s3_with_last_modified", "source_os_path.normpath", "source_os_path.join", "str", "path_mapping_rule_applier.strict_transform", "new_manifest_paths.append", "output_unmapped_paths.append"]
0
[]
The function (_download_manifest_and_make_paths_absolute) defined within the public class called public.The function start at line 202 and ends at 248. It contains 37 lines of code and it has a cyclomatic complexity of 7. It takes 9 parameters, represented as [202.0] and does not return any value. It declares 7.0 functions, and It has 7.0 functions called inside which are ["_get_asset_root_and_manifest_from_s3_with_last_modified", "source_os_path.normpath", "source_os_path.join", "str", "path_mapping_rule_applier.strict_transform", "new_manifest_paths.append", "output_unmapped_paths.append"].
aws-deadline_deadline-cloud
public
public
0
0
_get_manifests_to_download
def _get_manifests_to_download(job_attachments_root_prefix: str,download_candidate_jobs: dict[str, dict[str, Any]],job_sessions: dict[str, list],path_mapping_rule_appliers: dict[str, Optional[_PathMappingRuleApplier]],) -> list[tuple[Optional[_PathMappingRuleApplier], str, str, str]]:"""Collect a list of (pathMappingRuleApplier, jobId, rootPath, manifest_s3_key) tuples for all the job attachments that need to be downloaded.Args:job_attachments_root_prefix: The queue.jobAttachmentSettings.rootPrefix field from the DeadlineCloud queue.download_candidate_jobs: A mapping from job id to jobs as returned by deadline.search_jobs.job_sessions: Contains each job's sessions and session actions, structured as job_sessions[job_id][session_index]["sessionActions"][session_action_index].See the function _get_job_sessions for more details.path_mapping_rule_appliers: A mapping from storage profile ID to the path mapping rule applier to use for it.If no path mapping should be used, is the empty {}.Returns:A list of (pathMappingRuleApplier, jobId, rootPath, manifest_s3_key) tuples for the manifest objects that need to be downloaded."""manifests_to_download: list[tuple[Optional[_PathMappingRuleApplier], str, str, str]] = []for job_id, session_list in job_sessions.items():job = download_candidate_jobs[job_id]for session in session_list:for session_action in session.get("sessionActions", []):# The manifests lists from the job and session action correspond, so we can zip them# together to attach the root path with the S3 manifest keyfor job_manifest, session_action_manifest in zip(job["attachments"]["manifests"], session_action["manifests"]):if "outputManifestPath" in session_action_manifest:manifests_to_download.append((path_mapping_rule_appliers[job["storageProfileId"]]if path_mapping_rule_applierselse None,job_id,job_manifest["rootPath"],"/".join([job_attachments_root_prefix,S3_MANIFEST_FOLDER_NAME,session_action_manifest["outputManifestPath"],]),))return manifests_to_download
7
32
4
188
1
251
299
251
job_attachments_root_prefix,download_candidate_jobs,job_sessions,path_mapping_rule_appliers
['job']
list[tuple[Optional[_PathMappingRuleApplier], str, str, str]]
{"AnnAssign": 1, "Assign": 1, "Expr": 2, "For": 4, "If": 1, "Return": 1}
5
49
5
["job_sessions.items", "session.get", "zip", "manifests_to_download.append", "join"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads._manifest_s3_downloads_py._download_all_manifests_with_absolute_paths"]
The function (_get_manifests_to_download) defined within the public class called public.The function start at line 251 and ends at 299. It contains 32 lines of code and it has a cyclomatic complexity of 7. It takes 4 parameters, represented as [251.0] and does not return any value. It declares 5.0 functions, It has 5.0 functions called inside which are ["job_sessions.items", "session.get", "zip", "manifests_to_download.append", "join"], It has 1.0 function calling this function which is ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads._manifest_s3_downloads_py._download_all_manifests_with_absolute_paths"].
aws-deadline_deadline-cloud
public
public
0
0
_download_all_manifests_with_absolute_paths
def _download_all_manifests_with_absolute_paths(queue: dict[str, Any],download_candidate_jobs: dict[str, dict[str, Any]],job_sessions: dict[str, list],path_mapping_rule_appliers: dict[str, Optional[_PathMappingRuleApplier]],output_unmapped_paths: dict[str, list[str]],boto3_session_for_s3: boto3.Session,print_function_callback: Callable[[str], None] = lambda msg: None,) -> list[tuple[datetime, BaseAssetManifest]]:"""Downloads all the manifest files that are in the session_actions of job_sessions, and uses the rootPathvalues taken from the job to make all the paths in the manifest absolute.Args:queue: The Deadline Cloud queue as returned by deadline.get_queue.download_candidate_jobs: A mapping from job id to jobs as returned by deadline.search_jobs.job_sessions: Contains each job's sessions and session actions, structured as job_sessions[job_id][session_index]["sessionActions"][session_action_index].See the function _get_job_sessions for more details.path_mapping_rule_appliers: A mapping from storage profile ID to the path mapping rule applier to use for it.If no path mapping should be used, is the empty {}.boto3_session_for_s3: The boto3.Session to use for accessing S3.output_unmapped_paths: A mapping from the job id to a list of all the paths that were not mappedand therefore will not be downloaded.print_function_callback: Callback for printing output to the terminal or log.Returns:A list of BaseAssetManifest objects containing local absolute file paths sorted by the last_modified timestamp."""# Get the list of (rootPath, manifest_s3_key) tuples to download from S3.manifests_to_download: list[tuple[Optional[_PathMappingRuleApplier], str, str, str]] = (_get_manifests_to_download(queue["jobAttachmentSettings"]["rootPrefix"],download_candidate_jobs,job_sessions,path_mapping_rule_appliers,))print_function_callback("")print_function_callback(f"Downloading {len(manifests_to_download)} asset manifests from S3...")start_time = datetime.now(tz=timezone.utc)# Download all the manifest files from S3, and make the paths in the manifests absolute local paths# by joining with the root path and normalizingdownloaded_manifests: list = [None] * len(manifests_to_download)# All the unmapped paths get recorded here as (jobId, unmappedPath)unmapped_paths: list[tuple[str, str]] = []max_workers = S3_DOWNLOAD_MAX_CONCURRENCYprint_function_callback(f"Using {max_workers} threads")with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:futures = []for index, (path_mapping_rule_applier, job_id, root_path, manifest_s3_key) in enumerate(manifests_to_download):futures.append(executor.submit(_download_manifest_and_make_paths_absolute,index,queue,job_id,root_path,manifest_s3_key,path_mapping_rule_applier,boto3_session_for_s3,downloaded_manifests,unmapped_paths,))# surfaces any exceptions in the threadfor future in concurrent.futures.as_completed(futures):future.result()# Transform the unmapped paths into the output, grouping by job idfor job_id, unmapped_path in unmapped_paths:output_unmapped_paths.setdefault(job_id, []).append(unmapped_path)duration = datetime.now(tz=timezone.utc) - start_timeprint_function_callback(f"...downloaded manifests in {duration}")return downloaded_manifests
4
50
8
311
4
302
382
302
queue,download_candidate_jobs,job_sessions,path_mapping_rule_appliers,output_unmapped_paths,boto3_session_for_s3,print_function_callback
['max_workers', 'start_time', 'duration', 'futures']
list[tuple[datetime, BaseAssetManifest]]
{"AnnAssign": 3, "Assign": 4, "Expr": 8, "For": 3, "Return": 1, "With": 1}
17
81
17
["_get_manifests_to_download", "print_function_callback", "print_function_callback", "len", "datetime.now", "len", "print_function_callback", "concurrent.futures.ThreadPoolExecutor", "enumerate", "futures.append", "executor.submit", "concurrent.futures.as_completed", "future.result", "append", "output_unmapped_paths.setdefault", "datetime.now", "print_function_callback"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._incremental_download_py._incremental_output_download", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.incremental_downloads.test_manifest_download_py.test_manifest_and_output_downloads"]
The function (_download_all_manifests_with_absolute_paths) defined within the public class called public.The function start at line 302 and ends at 382. It contains 50 lines of code and it has a cyclomatic complexity of 4. It takes 8 parameters, represented as [302.0] and does not return any value. It declares 17.0 functions, It has 17.0 functions called inside which are ["_get_manifests_to_download", "print_function_callback", "print_function_callback", "len", "datetime.now", "len", "print_function_callback", "concurrent.futures.ThreadPoolExecutor", "enumerate", "futures.append", "executor.submit", "concurrent.futures.as_completed", "future.result", "append", "output_unmapped_paths.setdefault", "datetime.now", "print_function_callback"], It has 2.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._incremental_download_py._incremental_output_download", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.incremental_downloads.test_manifest_download_py.test_manifest_and_output_downloads"].
aws-deadline_deadline-cloud
public
public
0
0
_merge_absolute_path_manifest_list
def _merge_absolute_path_manifest_list(downloaded_manifests: list[tuple[datetime, BaseAssetManifest]],) -> list[BaseManifestPath]:"""Given a list of manifests that contain absolute paths, uses the provided last modified timestampsto sort them, and merges them all into a single manifest. Returns the list of manifest pathsfor download.Args:downloaded_manifests: A list of (last_modified_timestamp, manifest) tuples, where each lastmodified timestamp is the LastModified datetime from the S3 object holding the manifest.Returns:A list of manifest paths to download, the result of merging the manifests."""# Because the paths in manifests are all absolute and normalized now, we can merge them# in order by inserting them into a dict in order, using the normcased path as the key.# Later files of the same name will overwrite earlier ones.# Sort the manifests by last modified, so that we can overlay them# with later manifests overwriting files from earlier ones.downloaded_manifests.sort(key=lambda item: item[0])merged_manifest_paths_dict = {}for _, manifest in downloaded_manifests:for manifest_path in manifest.paths:merged_manifest_paths_dict[os.path.normcase(manifest_path.path)] = manifest_pathreturn list(merged_manifest_paths_dict.values())
3
9
1
78
1
385
412
385
downloaded_manifests
['merged_manifest_paths_dict']
list[BaseManifestPath]
{"Assign": 2, "Expr": 2, "For": 2, "Return": 1}
4
28
4
["downloaded_manifests.sort", "os.path.normcase", "list", "merged_manifest_paths_dict.values"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._incremental_download_py._incremental_output_download", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.incremental_downloads.test_manifest_download_py.test_manifest_and_output_downloads"]
The function (_merge_absolute_path_manifest_list) defined within the public class called public.The function start at line 385 and ends at 412. It contains 9 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 4.0 functions, It has 4.0 functions called inside which are ["downloaded_manifests.sort", "os.path.normcase", "list", "merged_manifest_paths_dict.values"], It has 2.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._incremental_download_py._incremental_output_download", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.incremental_downloads.test_manifest_download_py.test_manifest_and_output_downloads"].
aws-deadline_deadline-cloud
public
public
0
0
_download_file_with_transfer_manager.handler
def handler(bytes_downloaded):nonlocal progress_trackernonlocal futureshould_continue = progress_tracker.track_progress_callback(bytes_downloaded)if not should_continue:future.cancel()
2
6
1
26
0
431
437
431
null
[]
None
null
0
0
0
null
0
null
The function (_download_file_with_transfer_manager.handler) defined within the public class called public.The function start at line 431 and ends at 437. It contains 6 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
aws-deadline_deadline-cloud
public
public
0
0
_download_file_with_transfer_manager
def _download_file_with_transfer_manager(local_file_path: Path,s3_bucket: str,s3_key: str,boto3_session: boto3.Session,s3_client: BaseClient,progress_tracker: ProgressTracker,):"""Downloads a single file from S3 using S3 transfer manager. This is appropriate for a largerfile that benefits from parallel multi-part download."""transfer_manager = get_s3_transfer_manager(s3_client=s3_client)future: concurrent.futures.Futuredef handler(bytes_downloaded):nonlocal progress_trackernonlocal futureshould_continue = progress_tracker.track_progress_callback(bytes_downloaded)if not should_continue:future.cancel()subscribers = [ProgressCallbackInvoker(handler)]future = transfer_manager.download(bucket=s3_bucket,key=s3_key,fileobj=str(local_file_path),extra_args={"ExpectedBucketOwner": get_account_id(session=boto3_session)},subscribers=subscribers,)future.result()
1
20
6
100
4
415
449
415
local_file_path,s3_bucket,s3_key,boto3_session,s3_client,progress_tracker
['subscribers', 'should_continue', 'future', 'transfer_manager']
None
{"AnnAssign": 1, "Assign": 4, "Expr": 3, "If": 1}
8
35
8
["get_s3_transfer_manager", "progress_tracker.track_progress_callback", "future.cancel", "ProgressCallbackInvoker", "transfer_manager.download", "str", "get_account_id", "future.result"]
0
[]
The function (_download_file_with_transfer_manager) defined within the public class called public.The function start at line 415 and ends at 449. It contains 20 lines of code and it has a cyclomatic complexity of 1. It takes 6 parameters, represented as [415.0] and does not return any value. It declares 8.0 functions, and It has 8.0 functions called inside which are ["get_s3_transfer_manager", "progress_tracker.track_progress_callback", "future.cancel", "ProgressCallbackInvoker", "transfer_manager.download", "str", "get_account_id", "future.result"].
aws-deadline_deadline-cloud
public
public
0
0
_download_file_with_get_object
def _download_file_with_get_object(local_file_path: Path,s3_bucket: str,s3_key: str,boto3_session: boto3.Session,s3_client: BaseClient,progress_tracker: ProgressTracker,):"""Downloads a single file from S3 using get_object. This is appropriate for a smallerfile that benefits from reduced overhead."""res = s3_client.get_object(Bucket=s3_bucket,Key=s3_key,ExpectedBucketOwner=get_account_id(session=boto3_session),)body = res["Body"]# Copy the data this amount at a timebuffer_size = 128 * 1024with open(local_file_path, "wb") as fh:while True:data = body.read(buffer_size)if not data:breakshould_continue = progress_tracker.track_progress_callback(len(data))if not should_continue:fh.close()os.remove(local_file_path)raise AssetSyncCancelledError("File download cancelled.")fh.write(data)
4
26
6
129
5
452
482
452
local_file_path,s3_bucket,s3_key,boto3_session,s3_client,progress_tracker
['res', 'body', 'buffer_size', 'should_continue', 'data']
None
{"Assign": 5, "Expr": 4, "If": 2, "While": 1, "With": 1}
10
31
10
["s3_client.get_object", "get_account_id", "open", "body.read", "progress_tracker.track_progress_callback", "len", "fh.close", "os.remove", "AssetSyncCancelledError", "fh.write"]
0
[]
The function (_download_file_with_get_object) defined within the public class called public.The function start at line 452 and ends at 482. It contains 26 lines of code and it has a cyclomatic complexity of 4. It takes 6 parameters, represented as [452.0] and does not return any value. It declares 10.0 functions, and It has 10.0 functions called inside which are ["s3_client.get_object", "get_account_id", "open", "body.read", "progress_tracker.track_progress_callback", "len", "fh.close", "os.remove", "AssetSyncCancelledError", "fh.write"].
aws-deadline_deadline-cloud
public
public
0
0
_download_file
def _download_file(file: BaseManifestPath,hash_algorithm: HashAlgorithm,collision_lock: Lock,collision_file_dict: DefaultDict[str, int],s3_bucket: str,cas_prefix: str,s3_client: BaseClient,boto3_session_for_s3: boto3.Session,progress_tracker: ProgressTracker,file_conflict_resolution: FileConflictResolution,) -> None:"""Downloads a file from the S3 bucket to the local directory.Args:file: A BaseManifestPath whose path is a local absolute path.hash_algorithm: The hash algorithm used for the queue.collision_lock: A lock to ensure only one thread resolves a path name collision at a time.collision_file_dict: Dictionary for tracking path name collisions.s3_bucket: The job attachments S3 bucket.cas_prefix: The prefix for content-addressed data files in the S3 bucket.s3_client: A boto3 client for accessing S3.boto3_session_for_s3: The boto3.Session to use for accessing S3.progress_tracker: Object to update with download progress status.file_conflict_resolution: The strategy to use for file conflict resolution."""local_file_path = _get_long_path_compatible_path(file.path)s3_key = f"{cas_prefix}/{file.hash}.{hash_algorithm.value}"# If the file name already exists, resolve the conflict based on the file_conflict_resolutionif local_file_path.is_file():if file_conflict_resolution == FileConflictResolution.SKIP:returnelif file_conflict_resolution == FileConflictResolution.OVERWRITE:passelif file_conflict_resolution == FileConflictResolution.CREATE_COPY:local_file_path = _get_new_copy_file_path(local_file_path, collision_lock, collision_file_dict)else:raise ValueError(f"Unknown choice for file conflict resolution: {file_conflict_resolution}")local_file_path.parent.mkdir(parents=True, exist_ok=True)if file.size > 1024 * 1024:download_file = _download_file_with_transfer_managerelse:download_file = _download_file_with_get_objecttry:download_file(local_file_path=local_file_path,s3_bucket=s3_bucket,s3_key=s3_key,boto3_session=boto3_session_for_s3,s3_client=s3_client,progress_tracker=progress_tracker,)except concurrent.futures.CancelledError as ce:if progress_tracker and progress_tracker.continue_reporting is False:raise AssetSyncCancelledError("File download cancelled.")else:raise AssetSyncError("File download failed.", ce) from ceexcept ClientError as exc:status_code = int(exc.response["ResponseMetadata"]["HTTPStatusCode"])status_code_guidance = {**COMMON_ERROR_GUIDANCE_FOR_S3,403: (("Forbidden or Access denied. Please check your AWS credentials, and ensure that ""your AWS IAM Role or User has the 's3:GetObject' permission for this bucket. ")if "kms:" not in str(exc)else ("Forbidden or Access denied. Please check your AWS credentials and Job Attachments S3 bucket ""encryption settings. If a customer-managed KMS key is set, confirm that your AWS IAM Role or ""User has the 'kms:Decrypt' and 'kms:DescribeKey' permissions for the key used to encrypt the bucket.")),404: ("Not found. Please check your bucket name and object key, and ensure that they exist in the AWS account."),}raise JobAttachmentsS3ClientError(action="downloading file",status_code=status_code,bucket_name=s3_bucket,key_or_prefix=s3_key,message=f"{status_code_guidance.get(status_code, '')} {str(exc)} (Failed to download the file to {str(local_file_path)})",) from excexcept BotoCoreError as bce:raise JobAttachmentS3BotoCoreError(action="downloading file",error_details=str(bce),) from bceexcept Exception as e:raise AssetSyncError(e) from e# The modified time in the manifest is in microseconds, but utime requires the time be expressed in seconds.modified_time_override = file.mtime / 1000000# type: ignore[attr-defined]os.utime(local_file_path, (modified_time_override, modified_time_override))# type: ignore[arg-type]# Verify that what we downloaded has the correct file size from the manifest.file_size_on_disk = os.path.getsize(local_file_path)if file_size_on_disk != file.size:# TODO: Improve this error messageraise JobAttachmentsError(f"File from S3 for {file.path} had incorrect size {file_size_on_disk}. Required size: {file.size}")
14
87
10
366
7
485
597
485
file,hash_algorithm,collision_lock,collision_file_dict,s3_bucket,cas_prefix,s3_client,boto3_session_for_s3,progress_tracker,file_conflict_resolution
['s3_key', 'download_file', 'status_code', 'file_size_on_disk', 'modified_time_override', 'status_code_guidance', 'local_file_path']
None
{"Assign": 9, "Expr": 4, "If": 7, "Return": 1, "Try": 1}
20
113
20
["_get_long_path_compatible_path", "local_file_path.is_file", "_get_new_copy_file_path", "ValueError", "local_file_path.parent.mkdir", "download_file", "AssetSyncCancelledError", "AssetSyncError", "int", "str", "JobAttachmentsS3ClientError", "status_code_guidance.get", "str", "str", "JobAttachmentS3BotoCoreError", "str", "AssetSyncError", "os.utime", "os.path.getsize", "JobAttachmentsError"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3926305_ableton_groovylint.run_codenarc_py._download_jar_with_retry", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3926305_ableton_groovylint.tests.test_run_codenarc_py.test_download_file_4xx", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3926305_ableton_groovylint.tests.test_run_codenarc_py.test_download_file_5xx"]
The function (_download_file) defined within the public class called public.The function start at line 485 and ends at 597. It contains 87 lines of code and it has a cyclomatic complexity of 14. It takes 10 parameters, represented as [485.0] and does not return any value. It declares 20.0 functions, It has 20.0 functions called inside which are ["_get_long_path_compatible_path", "local_file_path.is_file", "_get_new_copy_file_path", "ValueError", "local_file_path.parent.mkdir", "download_file", "AssetSyncCancelledError", "AssetSyncError", "int", "str", "JobAttachmentsS3ClientError", "status_code_guidance.get", "str", "str", "JobAttachmentS3BotoCoreError", "str", "AssetSyncError", "os.utime", "os.path.getsize", "JobAttachmentsError"], It has 3.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3926305_ableton_groovylint.run_codenarc_py._download_jar_with_retry", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3926305_ableton_groovylint.tests.test_run_codenarc_py.test_download_file_4xx", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3926305_ableton_groovylint.tests.test_run_codenarc_py.test_download_file_5xx"].
aws-deadline_deadline-cloud
public
public
0
0
_download_manifest_paths
def _download_manifest_paths(manifest_paths_to_download: list[BaseManifestPath],hash_algorithm: HashAlgorithm,queue: dict[str, Any],boto3_session_for_s3: boto3.Session,file_conflict_resolution: FileConflictResolution,on_downloading_files: Optional[Callable[[ProgressReportMetadata], bool]],print_function_callback: Callable[[str], None] = lambda msg: None,) -> None:"""Downloads all files from the S3 bucket in the Job Attachment settings to the specified directory.Args:manifest_paths_to_download: A list of manifest path objects to download, whose path is an absolute file system path.hash_algorithm: The hash algorithm in use by the queue.queue: The queue as returned by boto3 deadline.get_queue().boto3_session_for_s3: The boto3.Session to use for accessing S3.file_conflict_resolution: The strategy to use for file conflict resolution.on_downloading_files: A callback to handle progress messages and cancelation.print_function_callback: Callback for printing output to the terminal or log."""s3_settings = JobAttachmentS3Settings(**queue["jobAttachmentSettings"])s3_client = get_s3_client(session=boto3_session_for_s3)max_workers = _get_num_download_workers()collision_lock: Lock = Lock()collision_file_dict: DefaultDict[str, int] = DefaultDict(int)full_cas_prefix: str = s3_settings.full_cas_prefix()progress_tracker = ProgressTracker(status=ProgressStatus.DOWNLOAD_IN_PROGRESS,total_files=len(manifest_paths_to_download),total_bytes=sum(manifest_path.size for manifest_path in manifest_paths_to_download),on_progress_callback=on_downloading_files,)print_function_callback(f"Using {max_workers} threads")with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:futures = [executor.submit(_download_file,manifest_path,hash_algorithm,collision_lock,collision_file_dict,s3_settings.s3BucketName,full_cas_prefix,s3_client,boto3_session_for_s3,progress_tracker,file_conflict_resolution,)for manifest_path in manifest_paths_to_download]# surfaces any exceptions in the threadfor future in concurrent.futures.as_completed(futures):future.result()if progress_tracker:progress_tracker.increase_processed(1, 0)progress_tracker.report_progress()# to report progress 100% at the endif progress_tracker:progress_tracker.report_progress()
6
46
8
251
5
600
663
600
manifest_paths_to_download,hash_algorithm,queue,boto3_session_for_s3,file_conflict_resolution,on_downloading_files,print_function_callback
['futures', 's3_client', 'progress_tracker', 's3_settings', 'max_workers']
None
{"AnnAssign": 3, "Assign": 5, "Expr": 6, "For": 1, "If": 2, "With": 1}
17
64
17
["JobAttachmentS3Settings", "get_s3_client", "_get_num_download_workers", "Lock", "DefaultDict", "s3_settings.full_cas_prefix", "ProgressTracker", "len", "sum", "print_function_callback", "concurrent.futures.ThreadPoolExecutor", "executor.submit", "concurrent.futures.as_completed", "future.result", "progress_tracker.increase_processed", "progress_tracker.report_progress", "progress_tracker.report_progress"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._incremental_download_py._incremental_output_download", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.incremental_downloads.test_manifest_download_py.test_manifest_and_output_downloads"]
The function (_download_manifest_paths) defined within the public class called public.The function start at line 600 and ends at 663. It contains 46 lines of code and it has a cyclomatic complexity of 6. It takes 8 parameters, represented as [600.0] and does not return any value. It declares 17.0 functions, It has 17.0 functions called inside which are ["JobAttachmentS3Settings", "get_s3_client", "_get_num_download_workers", "Lock", "DefaultDict", "s3_settings.full_cas_prefix", "ProgressTracker", "len", "sum", "print_function_callback", "concurrent.futures.ThreadPoolExecutor", "executor.submit", "concurrent.futures.as_completed", "future.result", "progress_tracker.increase_processed", "progress_tracker.report_progress", "progress_tracker.report_progress"], It has 2.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._incremental_download_py._incremental_output_download", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.incremental_downloads.test_manifest_download_py.test_manifest_and_output_downloads"].
aws-deadline_deadline-cloud
public
public
0
0
_datetimes_to_str
def _datetimes_to_str(obj: Any) -> Any:"""Recursively applies the isoformat() function to all datetimes in the object"""if isinstance(obj, datetime):return obj.isoformat()elif isinstance(obj, list):return [_datetimes_to_str(item) for item in obj]elif isinstance(obj, dict):return {key: _datetimes_to_str(value) for key, value in obj.items()}else:return obj
6
9
1
74
0
17
26
17
obj
[]
Any
{"Expr": 1, "If": 3, "Return": 4}
7
10
7
["isinstance", "obj.isoformat", "isinstance", "_datetimes_to_str", "isinstance", "_datetimes_to_str", "obj.items"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._incremental_download_py._get_download_candidate_jobs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads.incremental_download_state_py.IncrementalDownloadJob.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads.incremental_download_state_py._datetimes_to_str"]
The function (_datetimes_to_str) defined within the public class called public.The function start at line 17 and ends at 26. It contains 9 lines of code and it has a cyclomatic complexity of 6. The function does not take any parameters and does not return any value. It declares 7.0 functions, It has 7.0 functions called inside which are ["isinstance", "obj.isoformat", "isinstance", "_datetimes_to_str", "isinstance", "_datetimes_to_str", "obj.items"], It has 3.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._incremental_download_py._get_download_candidate_jobs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads.incremental_download_state_py.IncrementalDownloadJob.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads.incremental_download_state_py._datetimes_to_str"].
aws-deadline_deadline-cloud
IncrementalDownloadJob
public
0
0
__init__
def __init__(self,job: dict[str, Any],session_ended_timestamp: Optional[datetime],session_completed_indexes: Optional[dict[str, int]],):"""Initialize a Job instance.Args:job (dict[str, Any]): The job as returned by boto3 from deadline:SearchJobs.session_ended_timestamp (Optional[datetime]): The largest endedAt timestamp for a sessionwhose output has been downloaded. This can be None only when the job lacks job attachments.session_completed_index (dict[str, int]): A mapping from session id to the indexof the latest completed session action download."""self.job = _datetimes_to_str(job)self.session_ended_timestamp = session_ended_timestampself.session_completed_indexes = session_completed_indexes or {}
2
9
4
56
0
40
57
40
self,job,session_ended_timestamp,session_completed_indexes
[]
None
{"Assign": 3, "Expr": 1}
1
18
1
["_datetimes_to_str"]
4,993
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16379211_lorcalhost_btb_manager_telegram.btb_manager_telegram.logging_py.LoggerHandler.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16379211_lorcalhost_btb_manager_telegram.btb_manager_telegram.schedule_py.TgScheduler.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.CalculatedAmountDiscrepancyError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.ExchangeRateMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.InvalidTransactionError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.ParsingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.PriceMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.QuantityNotPositiveError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.SymbolMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.UnexpectedColumnCountError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.UnexpectedRowCountError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.raw_py.RawTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.schwab_equity_award_json_py.SchwabTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.schwab_py.SchwabTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.trading212_py.Trading212Transaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.vanguard_py.VanguardTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.ExporterError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.FritzPasswordFileDoesNotExistError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.FritzPasswordTooLongError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.DeviceInfo.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HomeAutomation.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HostInfo.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HostNumberOfEntries.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.LanInterfaceConfig.__init__"]
The function (__init__) defined within the public class called IncrementalDownloadJob.The function start at line 40 and ends at 57. It contains 9 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [40.0] and does not return any value. It declare 1.0 function, It has 1.0 function called inside which is ["_datetimes_to_str"], It has 4993.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16379211_lorcalhost_btb_manager_telegram.btb_manager_telegram.logging_py.LoggerHandler.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16379211_lorcalhost_btb_manager_telegram.btb_manager_telegram.schedule_py.TgScheduler.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.CalculatedAmountDiscrepancyError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.ExchangeRateMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.InvalidTransactionError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.ParsingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.PriceMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.QuantityNotPositiveError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.SymbolMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.UnexpectedColumnCountError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.UnexpectedRowCountError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.raw_py.RawTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.schwab_equity_award_json_py.SchwabTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.schwab_py.SchwabTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.trading212_py.Trading212Transaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.vanguard_py.VanguardTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.ExporterError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.FritzPasswordFileDoesNotExistError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.FritzPasswordTooLongError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.DeviceInfo.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HomeAutomation.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HostInfo.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HostNumberOfEntries.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.LanInterfaceConfig.__init__"].
aws-deadline_deadline-cloud
IncrementalDownloadJob
public
0
0
job_id
def job_id(self) -> str:return self.job["jobId"]
1
2
1
14
0
60
61
60
self
[]
str
{"Return": 1}
0
2
0
[]
0
[]
The function (job_id) defined within the public class called IncrementalDownloadJob.The function start at line 60 and ends at 61. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
aws-deadline_deadline-cloud
IncrementalDownloadJob
public
0
0
from_dict
def from_dict(cls, data: dict[str, Any]) -> "IncrementalDownloadJob":"""Create a Job instance from a dictionary.Args:data (dict): Dictionary containing job dataReturns:Job: A new instance populated with the data"""if not isinstance(data, dict):raise ValueError("Input must be a dict.")missing_fields = [field for field in cls._required_dict_fields if field not in data]if missing_fields:raise ValueError(f"Input is missing required fields: {missing_fields}")job = data["job"]session_completed_indexes = data.get("sessionCompletedIndexes", {})session_ended_timestamp = (datetime.fromisoformat(data["sessionEndedTimestamp"])if data.get("sessionEndedTimestamp") is not Noneelse None)return cls(job=job,session_ended_timestamp=session_ended_timestamp,session_completed_indexes=session_completed_indexes,)
6
18
2
114
0
64
89
64
cls,data
[]
'IncrementalDownloadJob'
{"Assign": 4, "Expr": 1, "If": 2, "Return": 1}
7
26
7
["isinstance", "ValueError", "ValueError", "data.get", "data.get", "datetime.fromisoformat", "cls"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads.incremental_download_state_py.IncrementalDownloadState.from_dict", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95188692_yurujaja_pangaea_bench.pangaea.datasets.pastis_py.prepare_dates"]
The function (from_dict) defined within the public class called IncrementalDownloadJob.The function start at line 64 and ends at 89. It contains 18 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [64.0] and does not return any value. It declares 7.0 functions, It has 7.0 functions called inside which are ["isinstance", "ValueError", "ValueError", "data.get", "data.get", "datetime.fromisoformat", "cls"], It has 2.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads.incremental_download_state_py.IncrementalDownloadState.from_dict", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95188692_yurujaja_pangaea_bench.pangaea.datasets.pastis_py.prepare_dates"].
aws-deadline_deadline-cloud
IncrementalDownloadJob
public
0
0
to_dict
def to_dict(self) -> dict[str, Any]:"""Convert the Job to a dictionary.Returns:dict: Dictionary representation of the job"""result: dict[str, Any] = {"job": self.job,}if self.session_ended_timestamp is not None:result["sessionEndedTimestamp"] = self.session_ended_timestamp.isoformat()if self.session_completed_indexes != {}:result["sessionCompletedIndexes"] = self.session_completed_indexesreturn result
3
9
1
68
0
91
104
91
self
[]
dict[str, Any]
{"AnnAssign": 1, "Assign": 2, "Expr": 1, "If": 2, "Return": 1}
1
14
1
["self.session_ended_timestamp.isoformat"]
35
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3957978_dgilland_pydash.src.pydash.objects_py.omit_by", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3957978_dgilland_pydash.src.pydash.objects_py.pick_by", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3967770_docusign_code_examples_python.app.docusign.ds_client_py.DSClient.get_token", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.database.model.base_py.ProperDictMixin.to_proper_dict", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.database.utils_py.init_cls_from_base", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.services.models_py.edit", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.services.tasks_py.edit", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.59624560_openwpm_openwpm.openwpm.browser_manager_py.BrowserManagerHandle._unpack_pickled_error", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69272947_misp_misp_stix.tests._test_stix_export_py.TestCollectionSTIX1Export._check_stix1_collection_export_results", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69272947_misp_misp_stix.tests._test_stix_export_py.TestCollectionSTIX1Export._check_stix1_export_results", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69737800_eprbell_dali_rp2.src.dali.plugin.pair_converter.coinbase_advanced_py.PairConverterPlugin.get_historic_bar_from_native_source", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69848748_scverse_squidpy.src.squidpy.pl._ligrec_py.ligrec", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69936553_pandas_dev_pandas_stubs.tests.series.test_series_py.test_change_to_dict_return_type", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70258989_dynaconf_dynaconf.dynaconf.loaders.__init___py.write", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70258989_dynaconf_dynaconf.tests.test_base_py.test_dotted_set", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70538610_asfhyp3_hyp3_sdk.tests.test_hyp3_py.test_find_jobs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70538610_asfhyp3_hyp3_sdk.tests.test_hyp3_py.test_find_jobs_paging", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70538610_asfhyp3_hyp3_sdk.tests.test_hyp3_py.test_find_jobs_user_id", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.dataset.arrow.dec_py.ArrowDecoder.decode_batch", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.ext.rotbaum._model_py.QRX.fit", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.daf.tslib.engine.hyperopt_py.HyperOptManager.load_records", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.few_shot_prediction.src.meta.datasets.m1_py.generate_m1_dataset", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.few_shot_prediction.src.meta.datasets.m3_py.generate_m3_dataset", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.few_shot_prediction.src.meta.datasets.m4_py.generate_m4_dataset", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.tsbench.src.tsbench.surrogate.transformers.config_py.DatasetCatch22Encoder.fit"]
The function (to_dict) defined within the public class called IncrementalDownloadJob.The function start at line 91 and ends at 104. It contains 9 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declare 1.0 function, It has 1.0 function called inside which is ["self.session_ended_timestamp.isoformat"], It has 35.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3957978_dgilland_pydash.src.pydash.objects_py.omit_by", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3957978_dgilland_pydash.src.pydash.objects_py.pick_by", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3967770_docusign_code_examples_python.app.docusign.ds_client_py.DSClient.get_token", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.database.model.base_py.ProperDictMixin.to_proper_dict", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.database.utils_py.init_cls_from_base", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.services.models_py.edit", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.services.tasks_py.edit", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.59624560_openwpm_openwpm.openwpm.browser_manager_py.BrowserManagerHandle._unpack_pickled_error", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69272947_misp_misp_stix.tests._test_stix_export_py.TestCollectionSTIX1Export._check_stix1_collection_export_results", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69272947_misp_misp_stix.tests._test_stix_export_py.TestCollectionSTIX1Export._check_stix1_export_results", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69737800_eprbell_dali_rp2.src.dali.plugin.pair_converter.coinbase_advanced_py.PairConverterPlugin.get_historic_bar_from_native_source", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69848748_scverse_squidpy.src.squidpy.pl._ligrec_py.ligrec", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69936553_pandas_dev_pandas_stubs.tests.series.test_series_py.test_change_to_dict_return_type", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70258989_dynaconf_dynaconf.dynaconf.loaders.__init___py.write", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70258989_dynaconf_dynaconf.tests.test_base_py.test_dotted_set", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70538610_asfhyp3_hyp3_sdk.tests.test_hyp3_py.test_find_jobs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70538610_asfhyp3_hyp3_sdk.tests.test_hyp3_py.test_find_jobs_paging", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70538610_asfhyp3_hyp3_sdk.tests.test_hyp3_py.test_find_jobs_user_id", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.dataset.arrow.dec_py.ArrowDecoder.decode_batch", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.ext.rotbaum._model_py.QRX.fit", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.daf.tslib.engine.hyperopt_py.HyperOptManager.load_records", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.few_shot_prediction.src.meta.datasets.m1_py.generate_m1_dataset", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.few_shot_prediction.src.meta.datasets.m3_py.generate_m3_dataset", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.few_shot_prediction.src.meta.datasets.m4_py.generate_m4_dataset", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.tsbench.src.tsbench.surrogate.transformers.config_py.DatasetCatch22Encoder.fit"].
aws-deadline_deadline-cloud
IncrementalDownloadJob
public
0
0
__init__
def __init__(self,local_storage_profile_id: Optional[str],downloads_started_timestamp: datetime,downloads_completed_timestamp: Optional[datetime] = None,jobs: Optional[list] = None,eventual_consistency_max_seconds: Optional[int] = None,):"""Initialize a IncrementalDownloadState instance. To bootstrap the state, construct with only the downloads_started_timestamp.Args:local_storage_profile_id: The storage profile id for the host running the download command.If set to None, all jobs will be downloaded to the paths specified in the job, even if the machinethat submitted the job has a different configuration.downloads_started_timestamp (datetime): The timestamp of when the download state was bootstrapped.downloads_completed_timestamp (datetime): The timestamp up to which we are confident downloads are complete.jobs (list[IncrementalDownloadJob]): The list of jobs that entered 'active' status between downloads_started_timestampand downloads_completed_timestamp, and are not completed.eventual_consistency_max_seconds (Optional[int]): The duration, in seconds, for deadline:SearchJobs query overlap,to account for eventual consistency."""self.local_storage_profile_id = local_storage_profile_idself.downloads_started_timestamp = downloads_started_timestampif downloads_completed_timestamp is not None:self.downloads_completed_timestamp = downloads_completed_timestampelse:self.downloads_completed_timestamp = downloads_started_timestampif eventual_consistency_max_seconds:self.eventual_consistency_max_seconds = eventual_consistency_max_secondsself.jobs = jobs or []
4
17
6
89
0
154
184
154
self,job,session_ended_timestamp,session_completed_indexes
[]
None
{"Assign": 3, "Expr": 1}
1
18
1
["_datetimes_to_str"]
4,993
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16379211_lorcalhost_btb_manager_telegram.btb_manager_telegram.logging_py.LoggerHandler.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16379211_lorcalhost_btb_manager_telegram.btb_manager_telegram.schedule_py.TgScheduler.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.CalculatedAmountDiscrepancyError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.ExchangeRateMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.InvalidTransactionError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.ParsingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.PriceMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.QuantityNotPositiveError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.SymbolMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.UnexpectedColumnCountError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.UnexpectedRowCountError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.raw_py.RawTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.schwab_equity_award_json_py.SchwabTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.schwab_py.SchwabTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.trading212_py.Trading212Transaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.vanguard_py.VanguardTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.ExporterError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.FritzPasswordFileDoesNotExistError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.FritzPasswordTooLongError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.DeviceInfo.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HomeAutomation.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HostInfo.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HostNumberOfEntries.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.LanInterfaceConfig.__init__"]
The function (__init__) defined within the public class called IncrementalDownloadJob.The function start at line 154 and ends at 184. It contains 17 lines of code and it has a cyclomatic complexity of 4. It takes 6 parameters, represented as [154.0] and does not return any value. It declare 1.0 function, It has 1.0 function called inside which is ["_datetimes_to_str"], It has 4993.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16379211_lorcalhost_btb_manager_telegram.btb_manager_telegram.logging_py.LoggerHandler.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16379211_lorcalhost_btb_manager_telegram.btb_manager_telegram.schedule_py.TgScheduler.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.CalculatedAmountDiscrepancyError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.ExchangeRateMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.InvalidTransactionError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.ParsingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.PriceMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.QuantityNotPositiveError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.SymbolMissingError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.UnexpectedColumnCountError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.UnexpectedRowCountError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.raw_py.RawTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.schwab_equity_award_json_py.SchwabTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.schwab_py.SchwabTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.trading212_py.Trading212Transaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.vanguard_py.VanguardTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.ExporterError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.FritzPasswordFileDoesNotExistError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.config.exceptions_py.FritzPasswordTooLongError.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.DeviceInfo.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HomeAutomation.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HostInfo.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.HostNumberOfEntries.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.18106662_pdreker_fritz_exporter.fritzexporter.fritzcapabilities_py.LanInterfaceConfig.__init__"].
aws-deadline_deadline-cloud
IncrementalDownloadJob
public
0
0
from_dict
def from_dict(cls, data):"""Create a IncrementalDownloadState instance from a dictionary.Args:data (dict): Dictionary containing state file dataReturns:IncrementalDownloadState: A new instance populated with the data"""if not isinstance(data, dict):raise ValueError("Input must be a dict.")missing_fields = [field for field in cls._required_dict_fields if field not in data]if missing_fields:raise ValueError(f"Input is missing required fields: {missing_fields}")return cls(local_storage_profile_id=data["localStorageProfileId"],downloads_started_timestamp=datetime.fromisoformat(data["downloadsStartedTimestamp"]),downloads_completed_timestamp=datetime.fromisoformat(data["downloadsCompletedTimestamp"]),eventual_consistency_max_seconds=int(data["eventualConsistencyMaxSeconds"]),jobs=[IncrementalDownloadJob.from_dict(job) for job in data["jobs"]],)
6
15
2
110
0
187
209
187
cls,data
[]
'IncrementalDownloadJob'
{"Assign": 4, "Expr": 1, "If": 2, "Return": 1}
7
26
7
["isinstance", "ValueError", "ValueError", "data.get", "data.get", "datetime.fromisoformat", "cls"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads.incremental_download_state_py.IncrementalDownloadState.from_dict", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95188692_yurujaja_pangaea_bench.pangaea.datasets.pastis_py.prepare_dates"]
The function (from_dict) defined within the public class called IncrementalDownloadJob.The function start at line 187 and ends at 209. It contains 15 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [187.0] and does not return any value. It declares 7.0 functions, It has 7.0 functions called inside which are ["isinstance", "ValueError", "ValueError", "data.get", "data.get", "datetime.fromisoformat", "cls"], It has 2.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments._incremental_downloads.incremental_download_state_py.IncrementalDownloadState.from_dict", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95188692_yurujaja_pangaea_bench.pangaea.datasets.pastis_py.prepare_dates"].
aws-deadline_deadline-cloud
IncrementalDownloadJob
public
0
0
to_dict
def to_dict(self):"""Convert the IncrementalDownloadState to a dictionary.Returns:dict: Dictionary representation of the state file model"""result = {"localStorageProfileId": self.local_storage_profile_id,"downloadsStartedTimestamp": self.downloads_started_timestamp.isoformat(),"eventualConsistencyMaxSeconds": self.eventual_consistency_max_seconds,"jobs": [job.to_dict() for job in self.jobs],}if self.downloads_completed_timestamp is not None:result["downloadsCompletedTimestamp"] = self.downloads_completed_timestamp.isoformat()return result
3
10
1
70
0
211
226
211
self
[]
dict[str, Any]
{"AnnAssign": 1, "Assign": 2, "Expr": 1, "If": 2, "Return": 1}
1
14
1
["self.session_ended_timestamp.isoformat"]
35
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3957978_dgilland_pydash.src.pydash.objects_py.omit_by", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3957978_dgilland_pydash.src.pydash.objects_py.pick_by", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3967770_docusign_code_examples_python.app.docusign.ds_client_py.DSClient.get_token", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.database.model.base_py.ProperDictMixin.to_proper_dict", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.database.utils_py.init_cls_from_base", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.services.models_py.edit", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.services.tasks_py.edit", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.59624560_openwpm_openwpm.openwpm.browser_manager_py.BrowserManagerHandle._unpack_pickled_error", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69272947_misp_misp_stix.tests._test_stix_export_py.TestCollectionSTIX1Export._check_stix1_collection_export_results", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69272947_misp_misp_stix.tests._test_stix_export_py.TestCollectionSTIX1Export._check_stix1_export_results", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69737800_eprbell_dali_rp2.src.dali.plugin.pair_converter.coinbase_advanced_py.PairConverterPlugin.get_historic_bar_from_native_source", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69848748_scverse_squidpy.src.squidpy.pl._ligrec_py.ligrec", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69936553_pandas_dev_pandas_stubs.tests.series.test_series_py.test_change_to_dict_return_type", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70258989_dynaconf_dynaconf.dynaconf.loaders.__init___py.write", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70258989_dynaconf_dynaconf.tests.test_base_py.test_dotted_set", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70538610_asfhyp3_hyp3_sdk.tests.test_hyp3_py.test_find_jobs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70538610_asfhyp3_hyp3_sdk.tests.test_hyp3_py.test_find_jobs_paging", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70538610_asfhyp3_hyp3_sdk.tests.test_hyp3_py.test_find_jobs_user_id", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.dataset.arrow.dec_py.ArrowDecoder.decode_batch", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.ext.rotbaum._model_py.QRX.fit", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.daf.tslib.engine.hyperopt_py.HyperOptManager.load_records", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.few_shot_prediction.src.meta.datasets.m1_py.generate_m1_dataset", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.few_shot_prediction.src.meta.datasets.m3_py.generate_m3_dataset", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.few_shot_prediction.src.meta.datasets.m4_py.generate_m4_dataset", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.tsbench.src.tsbench.surrogate.transformers.config_py.DatasetCatch22Encoder.fit"]
The function (to_dict) defined within the public class called IncrementalDownloadJob.The function start at line 211 and ends at 226. It contains 10 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declare 1.0 function, It has 1.0 function called inside which is ["self.session_ended_timestamp.isoformat"], It has 35.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3957978_dgilland_pydash.src.pydash.objects_py.omit_by", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3957978_dgilland_pydash.src.pydash.objects_py.pick_by", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3967770_docusign_code_examples_python.app.docusign.ds_client_py.DSClient.get_token", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.database.model.base_py.ProperDictMixin.to_proper_dict", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.database.utils_py.init_cls_from_base", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.services.models_py.edit", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3981965_allegroai_clearml_server.apiserver.services.tasks_py.edit", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.59624560_openwpm_openwpm.openwpm.browser_manager_py.BrowserManagerHandle._unpack_pickled_error", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69272947_misp_misp_stix.tests._test_stix_export_py.TestCollectionSTIX1Export._check_stix1_collection_export_results", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69272947_misp_misp_stix.tests._test_stix_export_py.TestCollectionSTIX1Export._check_stix1_export_results", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69737800_eprbell_dali_rp2.src.dali.plugin.pair_converter.coinbase_advanced_py.PairConverterPlugin.get_historic_bar_from_native_source", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69848748_scverse_squidpy.src.squidpy.pl._ligrec_py.ligrec", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69936553_pandas_dev_pandas_stubs.tests.series.test_series_py.test_change_to_dict_return_type", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70258989_dynaconf_dynaconf.dynaconf.loaders.__init___py.write", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70258989_dynaconf_dynaconf.tests.test_base_py.test_dotted_set", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70538610_asfhyp3_hyp3_sdk.tests.test_hyp3_py.test_find_jobs", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70538610_asfhyp3_hyp3_sdk.tests.test_hyp3_py.test_find_jobs_paging", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70538610_asfhyp3_hyp3_sdk.tests.test_hyp3_py.test_find_jobs_user_id", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.dataset.arrow.dec_py.ArrowDecoder.decode_batch", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.ext.rotbaum._model_py.QRX.fit", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.daf.tslib.engine.hyperopt_py.HyperOptManager.load_records", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.few_shot_prediction.src.meta.datasets.m1_py.generate_m1_dataset", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.few_shot_prediction.src.meta.datasets.m3_py.generate_m3_dataset", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.few_shot_prediction.src.meta.datasets.m4_py.generate_m4_dataset", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70598532_awslabs_gluonts.src.gluonts.nursery.tsbench.src.tsbench.surrogate.transformers.config_py.DatasetCatch22Encoder.fit"].
aws-deadline_deadline-cloud
IncrementalDownloadState
public
0
0
from_file
def from_file(cls,file_path: str,) -> "IncrementalDownloadState":"""Loads progress from state file saved at saved_progress_checkpoint_full_path:param saved_progress_checkpoint_full_path: full path of the saved progress checkpoint file:param print_function_callback: Callback to print messages produced in this function.Used in the CLI to print to stdout using click.echo. By default, ignores messages.:return: Returns the loaded state file,or throws an exception if we're unable to read it as we already validated its existence"""state_data: dict = {}with open(file_path, "r") as file:state_data = json.load(file)download_state = IncrementalDownloadState.from_dict(state_data)return download_state
1
9
2
47
0
229
246
229
cls,file_path
[]
'IncrementalDownloadState'
{"AnnAssign": 1, "Assign": 2, "Expr": 1, "Return": 1, "With": 1}
3
18
3
["open", "json.load", "IncrementalDownloadState.from_dict"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._groups.queue_group_py.sync_output", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.incremental_downloads.test_incremental_download_state_py.TestIncrementalDownloadState.test_incremental_download_state_file_roundtrip"]
The function (from_file) defined within the public class called IncrementalDownloadState.The function start at line 229 and ends at 246. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [229.0] and does not return any value. It declares 3.0 functions, It has 3.0 functions called inside which are ["open", "json.load", "IncrementalDownloadState.from_dict"], It has 2.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._groups.queue_group_py.sync_output", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.incremental_downloads.test_incremental_download_state_py.TestIncrementalDownloadState.test_incremental_download_state_file_roundtrip"].
aws-deadline_deadline-cloud
IncrementalDownloadState
public
0
0
save_file
def save_file(self,file_path: str,) -> None:"""Save the current download progress to a state file atomically.:param file_path: Where to save the file.:param print_function_callback: Callback to print messages produced in this function.Used in the CLI to print to stdout using click.echo. By default, ignores messages:return: None if save was successful, throws an exception if we're unable to save progress file to download location."""# Create directory if it doesn't existfile_dir = os.path.dirname(file_path)os.makedirs(file_dir, exist_ok=True)state_data = self.to_dict()# Write the data to a unique temporary filenamewith tempfile.NamedTemporaryFile(mode="w",dir=file_dir,prefix=os.path.basename(file_path),encoding="utf-8",delete=False,) as tmpfile:json.dump(state_data, tmpfile.file, indent=2)# Atomically replace the target file with the temporary fileos.replace(tmpfile.name, file_path)
1
16
2
100
0
248
277
248
self,file_path
[]
None
{"Assign": 2, "Expr": 4, "With": 1}
7
30
7
["os.path.dirname", "os.makedirs", "self.to_dict", "tempfile.NamedTemporaryFile", "os.path.basename", "json.dump", "os.replace"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.86980582_aws_neuron_transformers_neuronx.src.transformers_neuronx.decoder_py.DecoderLayer.save_presharded_weights", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.86980582_aws_neuron_transformers_neuronx.src.transformers_neuronx.decoder_py.DecoderLmHeadForSamplingNoEmbedding.save_presharded_weights"]
The function (save_file) defined within the public class called IncrementalDownloadState.The function start at line 248 and ends at 277. It contains 16 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [248.0] and does not return any value. It declares 7.0 functions, It has 7.0 functions called inside which are ["os.path.dirname", "os.makedirs", "self.to_dict", "tempfile.NamedTemporaryFile", "os.path.basename", "json.dump", "os.replace"], It has 2.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.86980582_aws_neuron_transformers_neuronx.src.transformers_neuronx.decoder_py.DecoderLayer.save_presharded_weights", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.86980582_aws_neuron_transformers_neuronx.src.transformers_neuronx.decoder_py.DecoderLmHeadForSamplingNoEmbedding.save_presharded_weights"].
aws-deadline_deadline-cloud
public
public
0
0
_read_manifests
def _read_manifests(manifest_paths: List[str]) -> Dict[str, BaseAssetManifest]:"""Read in manfiests from the given file path list, and produce file name to manifest mapping.Args:manifest_paths (List[str]): List of file paths to manifest file.Raises:NonValidInputError: Raise when any of the file is not valid.Returns:Dict[str, BaseAssetManifest]: File name to encoded manifest mapping"""if nonvalid_files := [manifest for manifest in manifest_paths if not os.path.isfile(manifest)]:raise NonValidInputError(f"Specified manifests {nonvalid_files} are not valid.")with ExitStack() as stack:file_name_manifest_dict: Dict[str, BaseAssetManifest] = {os.path.basename(file_path): decode_manifest(stack.enter_context(open(file_path)).read())for file_path in manifest_paths}return file_name_manifest_dict
5
11
1
94
0
13
38
13
manifest_paths
[]
Dict[str, BaseAssetManifest]
{"AnnAssign": 1, "Expr": 1, "If": 1, "Return": 1, "With": 1}
8
26
8
["os.path.isfile", "NonValidInputError", "ExitStack", "os.path.basename", "decode_manifest", "read", "stack.enter_context", "open"]
6
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.attachment_py._attachment_download", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.attachment_py._attachment_upload", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.manifest_py._manifest_merge", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_utils_py.TestReadManifests.test_empty_manifest_list", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_utils_py.TestReadManifests.test_invalid_file_path", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_utils_py.TestReadManifests.test_valid_manifests"]
The function (_read_manifests) defined within the public class called public.The function start at line 13 and ends at 38. It contains 11 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value. It declares 8.0 functions, It has 8.0 functions called inside which are ["os.path.isfile", "NonValidInputError", "ExitStack", "os.path.basename", "decode_manifest", "read", "stack.enter_context", "open"], It has 6.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.attachment_py._attachment_download", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.attachment_py._attachment_upload", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.manifest_py._manifest_merge", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_utils_py.TestReadManifests.test_empty_manifest_list", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_utils_py.TestReadManifests.test_invalid_file_path", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_utils_py.TestReadManifests.test_valid_manifests"].
aws-deadline_deadline-cloud
public
public
0
0
_attachment_download
def _attachment_download(manifests: List[str],s3_root_uri: str,boto3_session: boto3.Session,path_mapping_rules: Optional[str] = None,logger: ClickLogger = ClickLogger(False),conflict_resolution: FileConflictResolution = FileConflictResolution.CREATE_COPY,):"""BETA API - This API is still evolving.API to download job attachments based on given list of manifests.If path mapping rules file is given, map to corresponding destinations.Args:manifests (List[str]): File Path to the manifest file for upload.s3_root_uri (str): S3 root uri including bucket name and root prefix.boto3_session (boto3.Session): Boto3 session for interacting with customer s3.path_mapping_rules (Optional[str], optional): Optional file path to a JSON file contains list of path mapping. Defaults to None.logger (ClickLogger, optional): Logger to provide visibility. Defaults to ClickLogger(False).Raises:NonValidInputError: raise when any of the input is not valid."""file_name_manifest_dict: Dict[str, BaseAssetManifest] = _read_manifests(manifest_paths=manifests)path_mapping_rule_list: List[PathMappingRule] = _process_path_mapping(path_mapping_rules=path_mapping_rules)_attachment_download_with_root_manifests(boto3_session,file_name_manifest_dict,s3_root_uri,conflict_resolution,path_mapping_rule_list,logger,)
1
22
5
91
0
27
67
27
manifests,s3_root_uri,boto3_session,path_mapping_rules,logger,conflict_resolution
[]
None
{"AnnAssign": 2, "Expr": 2}
4
41
4
["ClickLogger", "_read_manifests", "_process_path_mapping", "_attachment_download_with_root_manifests"]
8
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._groups.attachment_group_py.attachment_download", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentDownload.test_download_conflict_resolution", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentDownload.test_download_invalid_input_manifests", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentDownload.test_download_invalid_input_path_mapping_rules", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentDownload.test_download_invalid_input_s3_root_uri", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentDownload.test_download_multiple_to_current", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentDownload.test_download_single_to_current", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentDownload.test_download_single_to_mapped_invalid_path_mapping"]
The function (_attachment_download) defined within the public class called public.The function start at line 27 and ends at 67. It contains 22 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [27.0] and does not return any value. It declares 4.0 functions, It has 4.0 functions called inside which are ["ClickLogger", "_read_manifests", "_process_path_mapping", "_attachment_download_with_root_manifests"], It has 8.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._groups.attachment_group_py.attachment_download", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentDownload.test_download_conflict_resolution", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentDownload.test_download_invalid_input_manifests", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentDownload.test_download_invalid_input_path_mapping_rules", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentDownload.test_download_invalid_input_s3_root_uri", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentDownload.test_download_multiple_to_current", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentDownload.test_download_single_to_current", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentDownload.test_download_single_to_mapped_invalid_path_mapping"].
aws-deadline_deadline-cloud
public
public
0
0
_attachment_download_with_root_manifests
def _attachment_download_with_root_manifests(boto3_session: boto3.Session,file_name_manifest_dict: Dict[str, BaseAssetManifest],s3_root_uri: str,conflict_resolution: FileConflictResolution,path_mapping_rule_list: Optional[List[PathMappingRule]] = None,logger: ClickLogger = ClickLogger(False),):"""Function to use for attachment download when the caller has manifests and path mapping rule list,instead of reading these from input files.We should make this the default API Interface eventually to make it flexible:param boto3_session: boto3 session:param file_name_manifest_dict: Dictionary mapping manifest file names to their corresponding manifest objects.:param s3_root_uri: root uri for s3:param conflict_resolution: conflict resolution method for repeated files:param path_mapping_rule_list: path mapping rule list to map paths:param logger: logger:return:"""merged_manifests_by_root: Dict[str, BaseAssetManifest] = dict()for file_name, manifest in file_name_manifest_dict.items():# File name is supposed to be prefixed by a hash of source path in path mapping, use that to determine destination# If it doesn't appear in path mapping or mapping doesn't exist, download to current directory insteaddestination = next((rule.destination_pathfor rule in (path_mapping_rule_list or [])if rule.get_hashed_source_path(manifest.get_default_hash_alg()) in file_name),# Write to current directory partitioned by manifest name when no path mapping definedf"{os.getcwd()}/{file_name}",)# Assuming the manifest is already aggregated and correspond to a single destinationif merged_manifests_by_root.get(destination):raise NonValidInputError(f"{destination} is already in use, one destination path maps to one manifest file only.")merged_manifests_by_root[destination] = manifest# Given manifests and S3 bucket + root, downloads all files from a CAS in each manifest.s3_settings: JobAttachmentS3Settings = JobAttachmentS3Settings.from_s3_root_uri(s3_root_uri)download_summary: DownloadSummaryStatistics = download_files_from_manifests(s3_bucket=s3_settings.s3BucketName,manifests_by_root=merged_manifests_by_root,cas_prefix=s3_settings.full_cas_prefix(),session=boto3_session,conflict_resolution=conflict_resolution,)logger.echo(download_summary)logger.json(asdict(download_summary.convert_to_summary_statistics()))
6
33
6
190
1
70
124
70
boto3_session,file_name_manifest_dict,s3_root_uri,conflict_resolution,path_mapping_rule_list,logger
['destination']
None
{"AnnAssign": 3, "Assign": 2, "Expr": 3, "For": 1, "If": 1}
16
55
16
["ClickLogger", "dict", "file_name_manifest_dict.items", "next", "rule.get_hashed_source_path", "manifest.get_default_hash_alg", "os.getcwd", "merged_manifests_by_root.get", "NonValidInputError", "JobAttachmentS3Settings.from_s3_root_uri", "download_files_from_manifests", "s3_settings.full_cas_prefix", "logger.echo", "logger.json", "asdict", "download_summary.convert_to_summary_statistics"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.attachment_py._attachment_download"]
The function (_attachment_download_with_root_manifests) defined within the public class called public.The function start at line 70 and ends at 124. It contains 33 lines of code and it has a cyclomatic complexity of 6. It takes 6 parameters, represented as [70.0] and does not return any value. It declares 16.0 functions, It has 16.0 functions called inside which are ["ClickLogger", "dict", "file_name_manifest_dict.items", "next", "rule.get_hashed_source_path", "manifest.get_default_hash_alg", "os.getcwd", "merged_manifests_by_root.get", "NonValidInputError", "JobAttachmentS3Settings.from_s3_root_uri", "download_files_from_manifests", "s3_settings.full_cas_prefix", "logger.echo", "logger.json", "asdict", "download_summary.convert_to_summary_statistics"], It has 1.0 function calling this function which is ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.attachment_py._attachment_download"].
aws-deadline_deadline-cloud
public
public
0
0
_attachment_upload
def _attachment_upload(manifests: List[str],s3_root_uri: str,boto3_session: boto3.Session,root_dirs: List[str] = [],path_mapping_rules: Optional[str] = None,manifest_path_mapping: Optional[Dict[str, str]] = None,upload_manifest_path: Optional[str] = None,logger: ClickLogger = ClickLogger(False),) -> List[UploadManifestInfo]:"""BETA API - This API is still evolving.API to upload job attachments based on given list of manifests and corresponding file directories.If path mapping rules file is given, map to corresponding destinations.Args:manifests (List[str]): File Path to the manifest file for upload.s3_root_uri (str): S3 root uri including bucket name and root prefix.boto3_session (boto3.Session): Boto3 session for interacting with customer s3.root_dirs (List[str]): List of root directories holding attachments. Defaults to empty.path_mapping_rules (Optional[str], optional): Optional file path to a JSON file contains list of path mapping. Defaults to None.upload_manifest_path (Optional[str], optional): Optional path prefix for uploading given manifests. Defaults to None.logger (ClickLogger, optional): Logger to provide visibility. Defaults to ClickLogger(False).Returns:List[UploadManifestInfo]: A list of UploadManifestInfo objects corresponding to the input manifestscontaining manifest path, hash information, and source pathRaises:NonValidInputError: raise when any of the input is not valid."""file_name_manifest_dict: Dict[str, BaseAssetManifest] = _read_manifests(manifest_paths=manifests)if bool(path_mapping_rules) == bool(root_dirs):raise NonValidInputError("One of path mapping rule and root dir must exist, and not both.")path_mapping_rule_list: List[PathMappingRule] = _process_path_mapping(path_mapping_rules=path_mapping_rules, root_dirs=root_dirs)# Initialize an empty list to store manifest informationmanifest_info_list = []s3_settings: JobAttachmentS3Settings = JobAttachmentS3Settings.from_s3_root_uri(s3_root_uri)asset_uploader: S3AssetUploader = S3AssetUploader(session=boto3_session)# Iterate over original manifests in the order they were providedfor manifest_path in manifests:file_name = os.path.basename(manifest_path)manifest: BaseAssetManifest = file_name_manifest_dict[file_name]# File name is supposed to be prefixed by a hash of source path in path mapping or provided root dirsrule: Optional[PathMappingRule] = next(# search in path mapping to determine source and destination(rulefor rule in path_mapping_rule_listif rule.get_hashed_source_path(manifest.get_default_hash_alg()) in file_name),None,)if not rule:raise NonValidInputError(f"No valid root defined for given manifest {file_name}, please check input root dirs and path mapping rule.")metadata = {"Metadata": {"asset-root": json.dumps(rule.source_path, ensure_ascii=True)}}# S3 metadata must be ASCII, so use either 'asset-root' or 'asset-root-json' depending# on whether the value is ASCII.try:# Add the 'asset-root' metadata if the path is ASCIIrule.source_path.encode(encoding="ascii")metadata["Metadata"]["asset-root"] = rule.source_pathexcept UnicodeEncodeError:# Add the 'asset-root-json' metadata encoded to ASCII as a JSON stringmetadata["Metadata"]["asset-root-json"] = json.dumps(rule.source_path, ensure_ascii=True)if rule.source_path_format:metadata["Metadata"]["file-system-location-name"] = rule.source_path_format# Uploads all files to a CAS in the manifest, optionally upload manifest filekey, data = asset_uploader.upload_assets(job_attachment_settings=s3_settings,manifest=manifest,partial_manifest_prefix=upload_manifest_path,manifest_file_name=file_name,manifest_metadata=metadata,source_root=Path(rule.source_path),asset_root=Path(rule.destination_path),s3_check_cache_dir=config_file.get_cache_directory(),)logger.echo(f"Uploaded assets from {rule.destination_path}, to {s3_settings.to_s3_root_uri()}/Manifests/{key}, hashed data {data}")manifest_info_list.append(UploadManifestInfo(output_manifest_path=key,output_manifest_hash=data,source_path=rule.source_path,))return manifest_info_list
8
67
8
386
3
127
235
127
manifests,s3_root_uri,boto3_session,root_dirs,path_mapping_rules,manifest_path_mapping,upload_manifest_path,logger
['manifest_info_list', 'metadata', 'file_name']
List[UploadManifestInfo]
{"AnnAssign": 6, "Assign": 7, "Expr": 4, "For": 1, "If": 3, "Return": 1, "Try": 1}
24
109
24
["ClickLogger", "_read_manifests", "bool", "bool", "NonValidInputError", "_process_path_mapping", "JobAttachmentS3Settings.from_s3_root_uri", "S3AssetUploader", "os.path.basename", "next", "rule.get_hashed_source_path", "manifest.get_default_hash_alg", "NonValidInputError", "json.dumps", "rule.source_path.encode", "json.dumps", "asset_uploader.upload_assets", "Path", "Path", "config_file.get_cache_directory", "logger.echo", "s3_settings.to_s3_root_uri", "manifest_info_list.append", "UploadManifestInfo"]
10
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._groups.attachment_group_py.attachment_upload", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_both_root_dir_and_mapping", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_invalid_input_manifests", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_invalid_input_path_mapping_rules", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_invalid_input_s3_root_uri", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_no_mapped_root", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_no_root_dir_or_mapping", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_returns_manifest_info_list", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_single_from_mapped", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_single_map_from_root"]
The function (_attachment_upload) defined within the public class called public.The function start at line 127 and ends at 235. It contains 67 lines of code and it has a cyclomatic complexity of 8. It takes 8 parameters, represented as [127.0] and does not return any value. It declares 24.0 functions, It has 24.0 functions called inside which are ["ClickLogger", "_read_manifests", "bool", "bool", "NonValidInputError", "_process_path_mapping", "JobAttachmentS3Settings.from_s3_root_uri", "S3AssetUploader", "os.path.basename", "next", "rule.get_hashed_source_path", "manifest.get_default_hash_alg", "NonValidInputError", "json.dumps", "rule.source_path.encode", "json.dumps", "asset_uploader.upload_assets", "Path", "Path", "config_file.get_cache_directory", "logger.echo", "s3_settings.to_s3_root_uri", "manifest_info_list.append", "UploadManifestInfo"], It has 10.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._groups.attachment_group_py.attachment_upload", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_both_root_dir_and_mapping", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_invalid_input_manifests", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_invalid_input_path_mapping_rules", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_invalid_input_s3_root_uri", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_no_mapped_root", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_no_root_dir_or_mapping", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_returns_manifest_info_list", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_single_from_mapped", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.TestAttachmentUpload.test_upload_single_map_from_root"].
aws-deadline_deadline-cloud
public
public
0
0
_process_path_mapping
def _process_path_mapping(path_mapping_rules: Optional[str] = None, root_dirs: List[str] = []) -> List[PathMappingRule]:"""Process list of path mapping rules from the input path mapping file or root directories.Args:path_mapping_rules (Optional[str], optional): File path to path mapping rules. Defaults to None.root_dirs (List[str], optional): List of root directories path. Defaults to [].Raises:NonValidInputError: Raise if any of the path mapping rule file or root dirs are not valid.Returns:List[PathMappingRule]: List of processed PathMappingRule"""path_mapping_rule_list: List[PathMappingRule] = list()if path_mapping_rules:if not os.path.isfile(path_mapping_rules):raise NonValidInputError(f"Specified path mapping file {path_mapping_rules} is not valid.")with open(path_mapping_rules, encoding="utf8") as f:data = json.load(f)if "path_mapping_rules" in data:data = data["path_mapping_rules"]assert isinstance(data, list), "Path mapping rules have to be a list of dict."path_mapping_rule_list.extend([PathMappingRule(**mapping) for mapping in data])if nonvalid_dirs := [root for root in root_dirs if not os.path.isdir(root)]:raise NonValidInputError(f"Specified root dir {nonvalid_dirs} are not valid.")path_mapping_rule_list.extend(PathMappingRule(source_path_format="", source_path=root, destination_path=root)for root in root_dirs)return path_mapping_rule_list
9
22
2
166
1
238
278
238
path_mapping_rules,root_dirs
['data']
List[PathMappingRule]
{"AnnAssign": 1, "Assign": 2, "Expr": 3, "If": 4, "Return": 1, "With": 1}
12
41
12
["list", "os.path.isfile", "NonValidInputError", "open", "json.load", "isinstance", "path_mapping_rule_list.extend", "PathMappingRule", "os.path.isdir", "NonValidInputError", "path_mapping_rule_list.extend", "PathMappingRule"]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.attachment_py._attachment_download", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.attachment_py._attachment_upload", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.test_process_openjd_path_mapping", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.test_process_path_mapping"]
The function (_process_path_mapping) defined within the public class called public.The function start at line 238 and ends at 278. It contains 22 lines of code and it has a cyclomatic complexity of 9. It takes 2 parameters, represented as [238.0] and does not return any value. It declares 12.0 functions, It has 12.0 functions called inside which are ["list", "os.path.isfile", "NonValidInputError", "open", "json.load", "isinstance", "path_mapping_rule_list.extend", "PathMappingRule", "os.path.isdir", "NonValidInputError", "path_mapping_rule_list.extend", "PathMappingRule"], It has 4.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.attachment_py._attachment_download", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.attachment_py._attachment_upload", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.test_process_openjd_path_mapping", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_attachment_py.test_process_path_mapping"].
aws-deadline_deadline-cloud
public
public
0
0
_glob_files
def _glob_files(root: str,include: Optional[List[str]] = None,exclude: Optional[List[str]] = None,include_exclude_config: Optional[str] = None,) -> List[str]:""":param include: Include glob to look for files to add to the manifest.:param exclude: Exclude glob to exclude files from the manifest.:param include_exclude_config: Config JSON or file containeing input and exclude config.:returns: All files matching the include and exclude expressions."""# Get all files in the root.glob_config: GlobConfigif include or exclude:include = include if include is not None else default_glob_all()exclude = exclude if exclude is not None else []glob_config = GlobConfig(include_glob=include, exclude_glob=exclude)elif include_exclude_config:glob_config = _process_glob_inputs(include_exclude_config)else:# Default, include all.glob_config = GlobConfig()input_files = _glob_paths(root, include=glob_config.include_glob, exclude=glob_config.exclude_glob)return input_files
6
19
4
126
4
55
83
55
root,include,exclude,include_exclude_config
['exclude', 'glob_config', 'include', 'input_files']
List[str]
{"AnnAssign": 1, "Assign": 6, "Expr": 1, "If": 2, "Return": 1}
5
29
5
["default_glob_all", "GlobConfig", "_process_glob_inputs", "GlobConfig", "_glob_paths"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._groups.manifest_group_py.manifest_diff", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.manifest_py._manifest_diff"]
The function (_glob_files) defined within the public class called public.The function start at line 55 and ends at 83. It contains 19 lines of code and it has a cyclomatic complexity of 6. It takes 4 parameters, represented as [55.0] and does not return any value. It declares 5.0 functions, It has 5.0 functions called inside which are ["default_glob_all", "GlobConfig", "_process_glob_inputs", "GlobConfig", "_glob_paths"], It has 2.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._groups.manifest_group_py.manifest_diff", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.manifest_py._manifest_diff"].
aws-deadline_deadline-cloud
public
public
0
0
_manifest_snapshot
def _manifest_snapshot(root: str,destination: str,name: str,include: Optional[List[str]] = None,exclude: Optional[List[str]] = None,include_exclude_config: Optional[str] = None,diff: Optional[str] = None,force_rehash: bool = False,logger: ClickLogger = ClickLogger(False),) -> Optional[ManifestSnapshot]:# Get all files in the root.glob_config: GlobConfigif include or exclude:include = include if include is not None else default_glob_all()exclude = exclude if exclude is not None else []glob_config = GlobConfig(include_glob=include, exclude_glob=exclude)elif include_exclude_config:glob_config = _process_glob_inputs(include_exclude_config)else:# Default, include all.glob_config = GlobConfig()current_files = _glob_paths(root, include=glob_config.include_glob, exclude=glob_config.exclude_glob)# Compute the output manifest immediately and hash.if not diff:output_manifest = _create_manifest_for_single_root(files=current_files, root=root, logger=logger)if not output_manifest:return None# If this is a diff manifest, load the supplied manifest file.else:# Parse local manifestwith open(diff) as source_diff:source_manifest_str = source_diff.read()source_manifest = decode_manifest(source_manifest_str)# Get the differenceschanged_paths: List[str] = []# Fast comparison using time stamps and sizes.if not force_rehash:diff_list: List[Tuple[str, FileStatus]] = _fast_file_list_to_manifest_diff(root=root,current_files=current_files,diff_manifest=source_manifest,logger=logger,return_root_relative_path=False,)for diff_file in diff_list:# Add all new and modifiedif diff_file[1] != FileStatus.DELETED:changed_paths.append(diff_file[0])else:# In "slow / thorough" mode, we check by hash, which is definitive.output_manifest = _create_manifest_for_single_root(files=current_files, root=root, logger=logger)if not output_manifest:return Nonedifferences: List[Tuple[FileStatus, BaseManifestPath]] = compare_manifest(source_manifest, output_manifest)for diff_item in differences:if diff_item[0] == FileStatus.MODIFIED or diff_item[0] == FileStatus.NEW:full_diff_path = f"{root}/{diff_item[1].path}"changed_paths.append(full_diff_path)logger.echo(f"Found difference at: {full_diff_path}, Status: {diff_item[0]}")# If there were no files diffed, return None, there was nothing to snapshot.if len(changed_paths) == 0:return None# Since the files are already hashed, we can easily re-use has_attachments to remake a diff manifest.output_manifest = _create_manifest_for_single_root(files=changed_paths, root=root, logger=logger)if not output_manifest:return None# Write created manifest into local file, at the specified location at destinationif output_manifest is not None:local_manifest_file = _write_manifest(root=root,manifest=output_manifest,destination=destination,name=name,)# Output results.logger.echo(f"Manifest generated at {local_manifest_file}")return ManifestSnapshot(root=root, manifest=local_manifest_file)else:# No manifest generated.logger.echo("No manifest generated")return None
18
78
9
446
9
86
185
86
root,destination,name,include,exclude,include_exclude_config,diff,force_rehash,logger
['output_manifest', 'current_files', 'include', 'source_manifest', 'local_manifest_file', 'source_manifest_str', 'full_diff_path', 'glob_config', 'exclude']
Optional[ManifestSnapshot]
{"AnnAssign": 4, "Assign": 13, "Expr": 5, "For": 2, "If": 11, "Return": 6, "With": 1}
22
100
22
["ClickLogger", "default_glob_all", "GlobConfig", "_process_glob_inputs", "GlobConfig", "_glob_paths", "_create_manifest_for_single_root", "open", "source_diff.read", "decode_manifest", "_fast_file_list_to_manifest_diff", "changed_paths.append", "_create_manifest_for_single_root", "compare_manifest", "changed_paths.append", "logger.echo", "len", "_create_manifest_for_single_root", "_write_manifest", "logger.echo", "ManifestSnapshot", "logger.echo"]
13
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._groups.manifest_group_py.manifest_snapshot", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.cli.test_cli_manifest_upload_py.TestManifestUpload.create_manifest_file", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_manifest_diff_py.TestDiffAPI._snapshot_folder_helper", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_diff_with_includes_excludes", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_diff", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_diff_no_diff", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_diff_no_diff_modified_mtime", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_empty_folder", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_folder", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_includes_excludes", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_recursive_folder", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_size_diff", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_time_diff"]
The function (_manifest_snapshot) defined within the public class called public.The function start at line 86 and ends at 185. It contains 78 lines of code and it has a cyclomatic complexity of 18. It takes 9 parameters, represented as [86.0] and does not return any value. It declares 22.0 functions, It has 22.0 functions called inside which are ["ClickLogger", "default_glob_all", "GlobConfig", "_process_glob_inputs", "GlobConfig", "_glob_paths", "_create_manifest_for_single_root", "open", "source_diff.read", "decode_manifest", "_fast_file_list_to_manifest_diff", "changed_paths.append", "_create_manifest_for_single_root", "compare_manifest", "changed_paths.append", "logger.echo", "len", "_create_manifest_for_single_root", "_write_manifest", "logger.echo", "ManifestSnapshot", "logger.echo"], It has 13.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.client.cli._groups.manifest_group_py.manifest_snapshot", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.integ.cli.test_cli_manifest_upload_py.TestManifestUpload.create_manifest_file", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_manifest_diff_py.TestDiffAPI._snapshot_folder_helper", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_diff_with_includes_excludes", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_diff", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_diff_no_diff", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_diff_no_diff_modified_mtime", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_empty_folder", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_folder", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_includes_excludes", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_recursive_folder", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_size_diff", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.test.unit.deadline_job_attachments.api.test_snapshot_py.TestSnapshotAPI.test_snapshot_time_diff"].
aws-deadline_deadline-cloud
public
public
0
0
_write_manifest
def _write_manifest(root: str,manifest: BaseAssetManifest,destination: str,name: Optional[str] = None,) -> str:"""Write a manifest to a destination."""# Write created manifest into local file, at the specified location at destinationroot_hash: str = hash_data(root.encode("utf-8"), manifest.get_default_hash_alg())timestamp = datetime.datetime.now().strftime("%Y-%m-%dT%H-%M-%S")manifest_name = name if name else root.replace("/", "_").replace("\\", "_").replace(":", "_")manifest_name = manifest_name[1:] if manifest_name[0] == "_" else manifest_namemanifest_name = f"{manifest_name}-{root_hash}-{timestamp}.manifest"local_manifest_path = str(_get_long_path_compatible_path(os.path.join(destination, manifest_name),))os.makedirs(os.path.dirname(local_manifest_path), exist_ok=True)with open(local_manifest_path, "w") as file:file.write(manifest.encode())return local_manifest_path
3
20
4
167
3
188
213
188
root,manifest,destination,name
['timestamp', 'manifest_name', 'local_manifest_path']
str
{"AnnAssign": 1, "Assign": 5, "Expr": 3, "Return": 1, "With": 1}
16
26
16
["hash_data", "root.encode", "manifest.get_default_hash_alg", "strftime", "datetime.datetime.now", "replace", "replace", "root.replace", "str", "_get_long_path_compatible_path", "os.path.join", "os.makedirs", "os.path.dirname", "open", "file.write", "manifest.encode"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.manifest_py._manifest_merge", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.manifest_py._manifest_snapshot"]
The function (_write_manifest) defined within the public class called public.The function start at line 188 and ends at 213. It contains 20 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [188.0] and does not return any value. It declares 16.0 functions, It has 16.0 functions called inside which are ["hash_data", "root.encode", "manifest.get_default_hash_alg", "strftime", "datetime.datetime.now", "replace", "replace", "root.replace", "str", "_get_long_path_compatible_path", "os.path.join", "os.makedirs", "os.path.dirname", "open", "file.write", "manifest.encode"], It has 2.0 functions calling this function which are ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.manifest_py._manifest_merge", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94876780_aws_deadline_deadline_cloud.src.deadline.job_attachments.api.manifest_py._manifest_snapshot"].