From 592ce9785f265adb886a75f97f16f464339c6def Mon Sep 17 00:00:00 2001 From: Hana Joo Date: Thu, 2 Jul 2026 05:17:34 -0700 Subject: [PATCH] Automated Code Change PiperOrigin-RevId: 941641445 --- glazier/autobuild.py | 2 +- glazier/lib/actions/art.py | 2 +- glazier/lib/actions/base.py | 4 ++-- glazier/lib/actions/files.py | 2 +- glazier/lib/actions/googet.py | 2 +- glazier/lib/beyondcorp.py | 10 +++++----- glazier/lib/bitlocker.py | 6 +++--- glazier/lib/buildinfo.py | 12 ++++++------ glazier/lib/cache.py | 2 +- glazier/lib/config/base.py | 2 +- glazier/lib/config/builder.py | 6 +++--- glazier/lib/config/files.py | 10 +++++----- glazier/lib/config/runner.py | 4 ++-- glazier/lib/domain_join.py | 4 ++-- glazier/lib/download.py | 28 ++++++++++++++-------------- glazier/lib/file_util.py | 8 ++++---- glazier/lib/googet.py | 8 ++++---- glazier/lib/identifier.py | 6 +++--- glazier/lib/identity.py | 2 +- glazier/lib/log_copy.py | 4 ++-- glazier/lib/logs.py | 4 ++-- glazier/lib/ntp.py | 2 +- glazier/lib/os_selector.py | 2 +- glazier/lib/policies/base.py | 2 +- glazier/lib/powershell.py | 14 +++++++------- glazier/lib/registry.py | 12 ++++++------ glazier/lib/resources.py | 4 ++-- glazier/lib/spec/spec.py | 2 +- glazier/lib/splice.py | 4 ++-- glazier/lib/stage.py | 12 ++++++------ glazier/lib/terminator.py | 1 + glazier/lib/test_utils.py | 2 +- glazier/lib/timers.py | 4 ++-- glazier/lib/title.py | 2 +- 34 files changed, 96 insertions(+), 95 deletions(-) diff --git a/glazier/autobuild.py b/glazier/autobuild.py index 3f7acf05..6207a83d 100755 --- a/glazier/autobuild.py +++ b/glazier/autobuild.py @@ -48,7 +48,7 @@ class BatteryStatusError(Error): def __init__(self): super().__init__( - error_code=errors.ErrorCode.BATTERY_STATUS_ERROR, + error_code=errors.ErrorCode.BATTERY_STATUS_ERROR, # pyrefly: ignore[missing-attribute] message=StripMargin('Imaging process started while on battery'), ) diff --git a/glazier/lib/actions/art.py b/glazier/lib/actions/art.py index 408b8494..a2d45ae6 100644 --- a/glazier/lib/actions/art.py +++ b/glazier/lib/actions/art.py @@ -29,7 +29,7 @@ class FileNotFound(Error): def __init__(self, path: str): super().__init__( - error_code=errors.ErrorCode.FILE_NOT_FOUND, + error_code=errors.ErrorCode.FILE_NOT_FOUND, # pyrefly: ignore[missing-attribute] message=f'The following path does not exist: {path}') diff --git a/glazier/lib/actions/base.py b/glazier/lib/actions/base.py index 0dd4d8ae..0836973b 100644 --- a/glazier/lib/actions/base.py +++ b/glazier/lib/actions/base.py @@ -29,7 +29,7 @@ def __init__(self, message: Optional[str] = None): message = 'Error encountered while executing action' super().__init__( - error_code=errors.ErrorCode.ACTION_ERROR, + error_code=errors.ErrorCode.ACTION_ERROR, # pyrefly: ignore[missing-attribute] message=message) @@ -38,7 +38,7 @@ class ValidationError(errors.GlazierError): def __init__(self, message: str): super().__init__( - error_code=errors.ErrorCode.VALIDATION_ERROR, + error_code=errors.ErrorCode.VALIDATION_ERROR, # pyrefly: ignore[missing-attribute] message=message) diff --git a/glazier/lib/actions/files.py b/glazier/lib/actions/files.py index dd7619d9..271da3f1 100644 --- a/glazier/lib/actions/files.py +++ b/glazier/lib/actions/files.py @@ -41,7 +41,7 @@ def _Run(self, command: str, success_codes: List[int], raise ActionError() from e try: - command_list = shlex.split(command_cache, posix=False) + command_list = shlex.split(command_cache, posix=False) # pyrefly: ignore[bad-argument-type] result = execute.execute_binary( command_list[0], command_list[1:], diff --git a/glazier/lib/actions/googet.py b/glazier/lib/actions/googet.py index acf15c1a..e9d48cfd 100644 --- a/glazier/lib/actions/googet.py +++ b/glazier/lib/actions/googet.py @@ -58,7 +58,7 @@ def Run(self): pkg=args[0], retries=retries, sleep=sleep, - remove=remove, + remove=remove, # pyrefly: ignore[bad-argument-type] build_info=self._build_info, path=path, flags=flags diff --git a/glazier/lib/beyondcorp.py b/glazier/lib/beyondcorp.py index dfdccf2e..525e95d8 100644 --- a/glazier/lib/beyondcorp.py +++ b/glazier/lib/beyondcorp.py @@ -65,7 +65,7 @@ def __init__(self, tries: int, elapsed: float): 'Do you have a valid network configuration?' ) super().__init__( - error_code=errors.ErrorCode.BEYONDCORP_GIVE_UP, + error_code=errors.ErrorCode.BEYONDCORP_GIVE_UP, # pyrefly: ignore[missing-attribute] message=message) @@ -73,7 +73,7 @@ class BeyondCorpSeedFileError(Error): def __init__(self, file_path: str): super().__init__( - error_code=errors.ErrorCode.BEYONDCORP_SEED_FILE_MISSING, + error_code=errors.ErrorCode.BEYONDCORP_SEED_FILE_MISSING, # pyrefly: ignore[missing-attribute] message=f'BeyondCorp seed file not found: {file_path}', ) @@ -82,7 +82,7 @@ class BeyondCorpDriveLetterError(Error): def __init__(self, message: str): super().__init__( - error_code=errors.ErrorCode.BEYONDCORP_DRIVE_LETTER_ERROR, + error_code=errors.ErrorCode.BEYONDCORP_DRIVE_LETTER_ERROR, # pyrefly: ignore[missing-attribute] message=message) @@ -90,7 +90,7 @@ class BeyondCorpSignedUrlRequestError(Error): def __init__(self, message: str): super().__init__( - error_code=errors.ErrorCode.BEYONDCORP_REQUEST_ERROR, + error_code=errors.ErrorCode.BEYONDCORP_REQUEST_ERROR, # pyrefly: ignore[missing-attribute] message=message) @@ -102,7 +102,7 @@ def __init__(self, status_code: str, status: str): f'Status Code: {status_code}, Status: {status}' ) super().__init__( - error_code=errors.ErrorCode.BEYONDCORP_RESPONSE_ERROR, + error_code=errors.ErrorCode.BEYONDCORP_RESPONSE_ERROR, # pyrefly: ignore[missing-attribute] message=message) diff --git a/glazier/lib/bitlocker.py b/glazier/lib/bitlocker.py index 707ac4fe..33d373ad 100644 --- a/glazier/lib/bitlocker.py +++ b/glazier/lib/bitlocker.py @@ -31,7 +31,7 @@ class BitlockerEnableTpmError(Error): def __init__(self): super().__init__( - error_code=errors.ErrorCode.BITLOCKER_ENABLE_TPM_FAILED, + error_code=errors.ErrorCode.BITLOCKER_ENABLE_TPM_FAILED, # pyrefly: ignore[missing-attribute] message='Error while enabling TPM via Powershell') @@ -39,7 +39,7 @@ class BitlockerActivationFailedError(Error): def __init__(self): super().__init__( - error_code=errors.ErrorCode.BITLOCKER_ACTIVATION_FAILED, + error_code=errors.ErrorCode.BITLOCKER_ACTIVATION_FAILED, # pyrefly: ignore[missing-attribute] message='Bitlocker activation failed') @@ -47,7 +47,7 @@ class BitlockerUnknownModeError(Error): def __init__(self, mode: str): super().__init__( - error_code=errors.ErrorCode.BITLOCKER_UNKNOWN_MODE, + error_code=errors.ErrorCode.BITLOCKER_UNKNOWN_MODE, # pyrefly: ignore[missing-attribute] message=f'Unknown mode: {mode}') diff --git a/glazier/lib/buildinfo.py b/glazier/lib/buildinfo.py index fc7c4210..cc830be2 100755 --- a/glazier/lib/buildinfo.py +++ b/glazier/lib/buildinfo.py @@ -46,7 +46,7 @@ class IllegalPinError(Error): def __init__(self, pin_name: str): super().__init__( - error_code=errors.ErrorCode.ILLEGAL_PIN, + error_code=errors.ErrorCode.ILLEGAL_PIN, # pyrefly: ignore[missing-attribute] message=f'Referencing illegal pin name: {pin_name}') @@ -54,7 +54,7 @@ class YamlFileError(Error): def __init__(self, path: str): super().__init__( - error_code=errors.ErrorCode.YAML_FILE_ERROR, + error_code=errors.ErrorCode.YAML_FILE_ERROR, # pyrefly: ignore[missing-attribute] message=f'Error reading YAML file: {path}') @@ -62,7 +62,7 @@ class WMIError(Error): def __init__(self, message: str): super().__init__( - error_code=errors.ErrorCode.WMI_ERROR, + error_code=errors.ErrorCode.WMI_ERROR, # pyrefly: ignore[missing-attribute] message=message) @@ -70,7 +70,7 @@ class UnknownOsCodeError(Error): def __init__(self, os: str): super().__init__( - error_code=errors.ErrorCode.UNKNOWN_OS_CODE, + error_code=errors.ErrorCode.UNKNOWN_OS_CODE, # pyrefly: ignore[missing-attribute] message=f'Unknown OS code: {os}') @@ -78,7 +78,7 @@ class UndeterminedHostOsError(Error): def __init__(self): super().__init__( - error_code=errors.ErrorCode.UNDETERMINED_HOST_OS, + error_code=errors.ErrorCode.UNDETERMINED_HOST_OS, # pyrefly: ignore[missing-attribute] message='Unable to determine host OS.') @@ -86,7 +86,7 @@ class UnsupportedReleaseVersionError(Error): def __init__(self, os: str): super().__init__( - error_code=errors.ErrorCode.UNSUPPORTED_RELEASE_VERSION, + error_code=errors.ErrorCode.UNSUPPORTED_RELEASE_VERSION, # pyrefly: ignore[missing-attribute] message=f'Unable to find a release that supports {os}.') diff --git a/glazier/lib/cache.py b/glazier/lib/cache.py index ace41a2e..feb00fc5 100644 --- a/glazier/lib/cache.py +++ b/glazier/lib/cache.py @@ -37,7 +37,7 @@ class CacheError(Error): def __init__(self, file_path: str): super().__init__( - error_code=errors.ErrorCode.CACHE_MISS, + error_code=errors.ErrorCode.CACHE_MISS, # pyrefly: ignore[missing-attribute] message=f'Unable to download required file: {file_path}') diff --git a/glazier/lib/config/base.py b/glazier/lib/config/base.py index 658e9aec..186985d8 100644 --- a/glazier/lib/config/base.py +++ b/glazier/lib/config/base.py @@ -30,7 +30,7 @@ class ConfigError(Error): def __init__(self, message: str): super().__init__( - error_code=errors.ErrorCode.CONFIG_ERROR, + error_code=errors.ErrorCode.CONFIG_ERROR, # pyrefly: ignore[missing-attribute] message=message) diff --git a/glazier/lib/config/builder.py b/glazier/lib/config/builder.py index 8020e324..ddd178d6 100644 --- a/glazier/lib/config/builder.py +++ b/glazier/lib/config/builder.py @@ -70,7 +70,7 @@ class ConfigBuilderError(Error): def __init__(self): super().__init__( - error_code=errors.ErrorCode.FAILED_TASK_LIST_BUILD, + error_code=errors.ErrorCode.FAILED_TASK_LIST_BUILD, # pyrefly: ignore[missing-attribute] message='Failed to build the task list') @@ -78,7 +78,7 @@ class SysInfoError(Error): def __init__(self): super().__init__( - error_code=errors.ErrorCode.SYS_INFO, + error_code=errors.ErrorCode.SYS_INFO, # pyrefly: ignore[missing-attribute] message='Error gathering system information') @@ -86,7 +86,7 @@ class UnknownActionError(Error): def __init__(self, action: str): super().__init__( - error_code=errors.ErrorCode.UNKNOWN_ACTION, + error_code=errors.ErrorCode.UNKNOWN_ACTION, # pyrefly: ignore[missing-attribute] message=f'Unknown imaging action [{action}]') diff --git a/glazier/lib/config/files.py b/glazier/lib/config/files.py index 4cd09501..7e1423c1 100644 --- a/glazier/lib/config/files.py +++ b/glazier/lib/config/files.py @@ -31,7 +31,7 @@ class FileMoveError(Error): def __init__(self, src: str, dest: str): super().__init__( - error_code=errors.ErrorCode.FILE_MOVE_ERROR, + error_code=errors.ErrorCode.FILE_MOVE_ERROR, # pyrefly: ignore[missing-attribute] message=f'Failed to move file from {src} to {dest}') @@ -39,7 +39,7 @@ class FileRemoveError(Error): def __init__(self, path: str): super().__init__( - error_code=errors.ErrorCode.FILE_REMOVE_ERROR, + error_code=errors.ErrorCode.FILE_REMOVE_ERROR, # pyrefly: ignore[missing-attribute] message=f'Failed to remove file: {path}') @@ -47,7 +47,7 @@ class FileWriteError(Error): def __init__(self, path: str): super().__init__( - error_code=errors.ErrorCode.FILE_WRITE_ERROR, + error_code=errors.ErrorCode.FILE_WRITE_ERROR, # pyrefly: ignore[missing-attribute] message=f'Failed to write file: {path}') @@ -55,7 +55,7 @@ class FileReadError(Error): def __init__(self, path: str): super().__init__( - error_code=errors.ErrorCode.FILE_READ_ERROR, + error_code=errors.ErrorCode.FILE_READ_ERROR, # pyrefly: ignore[missing-attribute] message=f'Failed to read file: {path}') @@ -63,7 +63,7 @@ class FileDownloadError(Error): def __init__(self, url: str): super().__init__( - error_code=errors.ErrorCode.FILE_DOWNLOAD_ERROR, + error_code=errors.ErrorCode.FILE_DOWNLOAD_ERROR, # pyrefly: ignore[missing-attribute] message=f'Could not download file: {url}') diff --git a/glazier/lib/config/runner.py b/glazier/lib/config/runner.py index af55cd27..dcd61a60 100644 --- a/glazier/lib/config/runner.py +++ b/glazier/lib/config/runner.py @@ -36,7 +36,7 @@ class ConfigRunnerError(Error): def __init__(self): super().__init__( - error_code=errors.ErrorCode.FAILED_TASK_LIST_RUN, + error_code=errors.ErrorCode.FAILED_TASK_LIST_RUN, # pyrefly: ignore[missing-attribute] message='Failed to execute the task list') @@ -44,7 +44,7 @@ class UnknownPolicyError(Error): def __init__(self, policy: str): super().__init__( - error_code=errors.ErrorCode.UNKNOWN_POLICY, + error_code=errors.ErrorCode.UNKNOWN_POLICY, # pyrefly: ignore[missing-attribute] message=f'Unknown imaging policy [{policy}]') diff --git a/glazier/lib/domain_join.py b/glazier/lib/domain_join.py index 8e163678..c0492495 100644 --- a/glazier/lib/domain_join.py +++ b/glazier/lib/domain_join.py @@ -44,7 +44,7 @@ class DomainJoinError(Error): def __init__(self, message: str): super().__init__( - error_code=errors.ErrorCode.DOMAIN_JOIN_FAILURE, + error_code=errors.ErrorCode.DOMAIN_JOIN_FAILURE, # pyrefly: ignore[missing-attribute] message=message) @@ -125,7 +125,7 @@ def _InteractiveJoin(self): cmd += ['-OUPath', f'"{self._domain_ou}"'] try: logging.debug('Attempting to join the domain %s.', self._domain_name) - ps.RunCommand(cmd) + ps.RunCommand(cmd) # pyrefly: ignore[bad-argument-type] except powershell.Error as e: logging.error( 'Domain join failed. Sleeping 5 minutes then trying again. (%s)', e) diff --git a/glazier/lib/download.py b/glazier/lib/download.py index 0902bd7a..600614a3 100644 --- a/glazier/lib/download.py +++ b/glazier/lib/download.py @@ -61,7 +61,7 @@ class CheckUrlError(Error): def __init__(self, url: str): super().__init__( - error_code=errors.ErrorCode.FAILED_URL_VERIFICATION, + error_code=errors.ErrorCode.FAILED_URL_VERIFICATION, # pyrefly: ignore[missing-attribute] message=f'Failed to verify url [{url}]') @@ -69,7 +69,7 @@ class DownloadGiveUpError(Error): def __init__(self, tries: int, elapsed: float): super().__init__( - error_code=errors.ErrorCode.DOWNLOAD_GIVE_UP, + error_code=errors.ErrorCode.DOWNLOAD_GIVE_UP, # pyrefly: ignore[missing-attribute] message=f'Failed after {tries} attempt(s) over {elapsed:0.1f} seconds') @@ -77,7 +77,7 @@ class DownloadFailedError(Error): def __init__(self, url: str, code: int): super().__init__( - error_code=errors.ErrorCode.DOWNLOAD_FAILED, + error_code=errors.ErrorCode.DOWNLOAD_FAILED, # pyrefly: ignore[missing-attribute] message=f'Invalid return code [{code}] for file {url}') @@ -85,7 +85,7 @@ class InvalidRemoteUrlError(Error): def __init__(self, url: str): super().__init__( - error_code=errors.ErrorCode.DOWNLOAD_INVALID_REMOTE_URL, + error_code=errors.ErrorCode.DOWNLOAD_INVALID_REMOTE_URL, # pyrefly: ignore[missing-attribute] message=f'Invalid remote server URL "{url}".') @@ -93,7 +93,7 @@ class LocalCopyError(Error): def __init__(self, src: str, dest: str): super().__init__( - error_code=errors.ErrorCode.DOWNLOAD_LOCAL_COPY_ERROR, + error_code=errors.ErrorCode.DOWNLOAD_LOCAL_COPY_ERROR, # pyrefly: ignore[missing-attribute] message=f'Unable to copy local file from {src} to {dest}') @@ -101,7 +101,7 @@ class SignedUrlError(Error): def __init__(self, url: str): super().__init__( - error_code=errors.ErrorCode.DOWNLOAD_SIGNED_URL_ERROR, + error_code=errors.ErrorCode.DOWNLOAD_SIGNED_URL_ERROR, # pyrefly: ignore[missing-attribute] message=f'Failed to obtain signed URL: {url}') @@ -109,7 +109,7 @@ class MissingFileStreamError(Error): def __init__(self): super().__init__( - error_code=errors.ErrorCode.DOWNLOAD_MISSING_FILE_STREAM, + error_code=errors.ErrorCode.DOWNLOAD_MISSING_FILE_STREAM, # pyrefly: ignore[missing-attribute] message='Cannot save to disk, missing file stream') @@ -117,7 +117,7 @@ class StreamToDiskError(Error): def __init__(self, message: str): super().__init__( - error_code=errors.ErrorCode.DOWNLOAD_STREAM_TO_DISK_ERROR, + error_code=errors.ErrorCode.DOWNLOAD_STREAM_TO_DISK_ERROR, # pyrefly: ignore[missing-attribute] message=message) @@ -125,7 +125,7 @@ class FileValidationError(Error): def __init__(self, message: str): super().__init__( - error_code=errors.ErrorCode.DOWNLOAD_VALIDATION_ERROR, + error_code=errors.ErrorCode.DOWNLOAD_VALIDATION_ERROR, # pyrefly: ignore[missing-attribute] message=message) @@ -239,7 +239,7 @@ def _ConvertBytes(self, num_bytes: int) -> str: Returns: size: The number of bytes in human readable format (string). """ - num_bytes = float(num_bytes) + num_bytes = float(num_bytes) # pyrefly: ignore[bad-assignment] if num_bytes >= 1099511627776: terabytes = num_bytes / 1099511627776 size = '%.2fTB' % terabytes @@ -534,7 +534,7 @@ def _GetFileStreamSize(self, file_stream: 'http.client.HTTPResponse'): def _StreamToDisk(self, # pytype: disable=annotation-type-mismatch file_stream: 'http.client.HTTPResponse', - show_progress: bool = None): + show_progress: bool = None): # pyrefly: ignore[bad-function-definition] """Save a file stream to disk. Args: @@ -555,7 +555,7 @@ def _StreamToDisk(self, # pytype: disable=annotation-type-mismatch url, total_size = self._GetFileStreamSize(file_stream) try: - with open(self._save_location, 'wb') as output_file: + with open(self._save_location, 'wb') as output_file: # pyrefly: ignore[no-matching-overload] logging.info('Downloading file "%s" to "%s".', url.split('?')[0], self._save_location) while 1: @@ -588,12 +588,12 @@ def _Validate(self, file_stream: 'http.client.HTTPResponse', Raises: FileValidationError: File failed validation. """ - if not os.path.exists(self._save_location): + if not os.path.exists(self._save_location): # pyrefly: ignore[bad-argument-type] self._StoreDebugInfo(file_stream) raise FileValidationError( f'Could not locate file at {self._save_location}') - actual_file_size = os.path.getsize(self._save_location) + actual_file_size = os.path.getsize(self._save_location) # pyrefly: ignore[bad-argument-type] if actual_file_size != expected_size: self._StoreDebugInfo(file_stream) message = ( diff --git a/glazier/lib/file_util.py b/glazier/lib/file_util.py index baaee8df..7f7766f0 100644 --- a/glazier/lib/file_util.py +++ b/glazier/lib/file_util.py @@ -29,7 +29,7 @@ class FileCopyError(Error): def __init__(self, src: str, dest: str): super().__init__( - error_code=errors.ErrorCode.FILE_COPY_ERROR, + error_code=errors.ErrorCode.FILE_COPY_ERROR, # pyrefly: ignore[missing-attribute] message=f'Unable to copy {src} to {dest}') @@ -37,7 +37,7 @@ class DirectoryCreationError(Error): def __init__(self, dirname: str): super().__init__( - error_code=errors.ErrorCode.DIRECTORY_CREATION_ERROR, + error_code=errors.ErrorCode.DIRECTORY_CREATION_ERROR, # pyrefly: ignore[missing-attribute] message=f'Unable to create directory: {dirname}') @@ -45,7 +45,7 @@ class FileMoveError(Error): def __init__(self, src: str, dest: str): super().__init__( - error_code=errors.ErrorCode.FILE_MOVE_ERROR, + error_code=errors.ErrorCode.FILE_MOVE_ERROR, # pyrefly: ignore[missing-attribute] message=f'Failed to move file from {src} to {dest}') @@ -53,7 +53,7 @@ class FileRemoveError(Error): def __init__(self, path: str): super().__init__( - error_code=errors.ErrorCode.FILE_REMOVE_ERROR, + error_code=errors.ErrorCode.FILE_REMOVE_ERROR, # pyrefly: ignore[missing-attribute] message=f'Failed to remove file: {path}') diff --git a/glazier/lib/googet.py b/glazier/lib/googet.py index 43d052d0..694cb57f 100644 --- a/glazier/lib/googet.py +++ b/glazier/lib/googet.py @@ -40,7 +40,7 @@ class GooGetFlagError(Error): def __init__(self, message: str): super().__init__( - error_code=errors.ErrorCode.GOOGET_FLAG_ERROR, + error_code=errors.ErrorCode.GOOGET_FLAG_ERROR, # pyrefly: ignore[missing-attribute] message=message) @@ -48,7 +48,7 @@ class GooGetBinaryNotFoundError(Error): def __init__(self, path: str): super().__init__( - error_code=errors.ErrorCode.GOOGET_BINARY_NOT_FOUND, + error_code=errors.ErrorCode.GOOGET_BINARY_NOT_FOUND, # pyrefly: ignore[missing-attribute] message=f'Cannot find path of GooGet binary: {path}') @@ -56,7 +56,7 @@ class GooGetMissingPackageNameError(Error): def __init__(self): super().__init__( - error_code=errors.ErrorCode.GOOGET_MISSING_PACKAGE_NAME, + error_code=errors.ErrorCode.GOOGET_MISSING_PACKAGE_NAME, # pyrefly: ignore[missing-attribute] message='Missing package name for GooGet install.') @@ -64,7 +64,7 @@ class GooGetCommandFailedError(Error): def __init__(self, retries: int): super().__init__( - error_code=errors.ErrorCode.GOOGET_COMMAND_FAILED, + error_code=errors.ErrorCode.GOOGET_COMMAND_FAILED, # pyrefly: ignore[missing-attribute] message=f'GooGet command failed after {retries} attempts') diff --git a/glazier/lib/identifier.py b/glazier/lib/identifier.py index 67d03680..9c45fe56 100644 --- a/glazier/lib/identifier.py +++ b/glazier/lib/identifier.py @@ -39,14 +39,14 @@ def __init__(self, path: Optional[str] = constants.REG_ROOT): message = (fr'Failed to write to registry: [{path}\{name} = {value}]') super().__init__( - error_code=errors.ErrorCode.REGISTRY_WRITE_ERROR, message=message) + error_code=errors.ErrorCode.REGISTRY_WRITE_ERROR, message=message) # pyrefly: ignore[missing-attribute] class BuildInfoKeyMissingError(Error): def __init__(self, key: str, path: str): super().__init__( - error_code=errors.ErrorCode.BUILD_INFO_KEY_MISSING, + error_code=errors.ErrorCode.BUILD_INFO_KEY_MISSING, # pyrefly: ignore[missing-attribute] message=f'Could not determine {key} from file: {path}') @@ -54,7 +54,7 @@ class BuildInfoFileMissingError(Error): def __init__(self): super().__init__( - error_code=errors.ErrorCode.BUILD_INFO_FILE_MISSING, + error_code=errors.ErrorCode.BUILD_INFO_FILE_MISSING, # pyrefly: ignore[missing-attribute] message='Could not locate build info file.') diff --git a/glazier/lib/identity.py b/glazier/lib/identity.py index c116cc02..a93ee88e 100644 --- a/glazier/lib/identity.py +++ b/glazier/lib/identity.py @@ -33,7 +33,7 @@ class IdentityWriteError(Error): def __init__(self, name: str): super().__init__( - error_code=errors.ErrorCode.IDENTITY_WRITE_ERROR, + error_code=errors.ErrorCode.IDENTITY_WRITE_ERROR, # pyrefly: ignore[missing-attribute] message=f'Failed to write {name} to registry') diff --git a/glazier/lib/log_copy.py b/glazier/lib/log_copy.py index 89e6e9e1..0f70bc13 100755 --- a/glazier/lib/log_copy.py +++ b/glazier/lib/log_copy.py @@ -36,7 +36,7 @@ class LogCopyError(Error): def __init__(self, message: str): super().__init__( - error_code=errors.ErrorCode.LOG_COPY_FAILURE, + error_code=errors.ErrorCode.LOG_COPY_FAILURE, # pyrefly: ignore[missing-attribute] message=message) @@ -96,7 +96,7 @@ def _GetLogFileName(self): destination_file_date = gtime.now().replace(microsecond=0) destination_file_date = destination_file_date.isoformat() destination_file_date = destination_file_date.replace(':', '') - return 'l:\\' + hostname + '-' + destination_file_date + '.log' + return 'l:\\' + hostname + '-' + destination_file_date + '.log' # pyrefly: ignore[unsupported-operation] def _ShareUpload(self, source_log: str, share: str): """Copy the log file to a network file share. diff --git a/glazier/lib/logs.py b/glazier/lib/logs.py index f384b865..5fe6ac9a 100755 --- a/glazier/lib/logs.py +++ b/glazier/lib/logs.py @@ -38,7 +38,7 @@ class LogCollectionError(Error): def __init__(self): super().__init__( - error_code=errors.ErrorCode.LOGS_COLLECTION_ERROR, + error_code=errors.ErrorCode.LOGS_COLLECTION_ERROR, # pyrefly: ignore[missing-attribute] message='Error encountered while collecting logs') @@ -46,7 +46,7 @@ class LogOpenError(Error): def __init__(self, log_file: str): super().__init__( - error_code=errors.ErrorCode.LOGS_OPEN_ERROR, + error_code=errors.ErrorCode.LOGS_OPEN_ERROR, # pyrefly: ignore[missing-attribute] message=f'Failed to open log file: {log_file}') diff --git a/glazier/lib/ntp.py b/glazier/lib/ntp.py index a420d175..ead6ee1c 100644 --- a/glazier/lib/ntp.py +++ b/glazier/lib/ntp.py @@ -39,7 +39,7 @@ class NoNtpResponseError(Error): def __init__(self): super().__init__( - error_code=errors.ErrorCode.NO_NTP_RESPONSE, + error_code=errors.ErrorCode.NO_NTP_RESPONSE, # pyrefly: ignore[missing-attribute] message='No response from NTP server.') diff --git a/glazier/lib/os_selector.py b/glazier/lib/os_selector.py index aa1f5046..58a9eaa5 100644 --- a/glazier/lib/os_selector.py +++ b/glazier/lib/os_selector.py @@ -40,7 +40,7 @@ class UnsupportedModelError(Error): def __init__(self, model: str): super().__init__( - error_code=errors.ErrorCode.UNSUPPORTED_MODEL, + error_code=errors.ErrorCode.UNSUPPORTED_MODEL, # pyrefly: ignore[missing-attribute] message=f'System OS/model does not have imaging support: {model}') diff --git a/glazier/lib/policies/base.py b/glazier/lib/policies/base.py index 4893d040..aa2f16c6 100644 --- a/glazier/lib/policies/base.py +++ b/glazier/lib/policies/base.py @@ -22,7 +22,7 @@ class ImagingPolicyException(errors.GlazierError): def __init__(self, message: str): super().__init__( - error_code=errors.ErrorCode.POLICY_VERIFICATION_ERROR, + error_code=errors.ErrorCode.POLICY_VERIFICATION_ERROR, # pyrefly: ignore[missing-attribute] message=message) diff --git a/glazier/lib/powershell.py b/glazier/lib/powershell.py index d4322d71..24cd8277 100644 --- a/glazier/lib/powershell.py +++ b/glazier/lib/powershell.py @@ -45,7 +45,7 @@ def __init__(self, parameter: str): f'not found in {supported_params_str}.' ) super().__init__( - error_code=errors.ErrorCode.POWERSHELL_UNSUPPORTED_PARAMETER, + error_code=errors.ErrorCode.POWERSHELL_UNSUPPORTED_PARAMETER, # pyrefly: ignore[missing-attribute] message=message) @@ -53,7 +53,7 @@ class PowerShellExecutionError(Error): def __init__(self): super().__init__( - error_code=errors.ErrorCode.POWERSHELL_EXECUTION_ERROR, + error_code=errors.ErrorCode.POWERSHELL_EXECUTION_ERROR, # pyrefly: ignore[missing-attribute] message='Error encountered during PowerShell execution') @@ -61,7 +61,7 @@ class InvalidPathError(Error): def __init__(self, path: str): super().__init__( - error_code=errors.ErrorCode.POWERSHELL_INVALID_PATH, + error_code=errors.ErrorCode.POWERSHELL_INVALID_PATH, # pyrefly: ignore[missing-attribute] message=f'A path required by PowerShell in invalid: {path}') @@ -74,7 +74,7 @@ def __init__(self, policy: str): f'not found in {supported_policies_str}.' ) super().__init__( - error_code=errors.ErrorCode.POWERSHELL_UNSUPPORTED_EXECUTION_POLICY, + error_code=errors.ErrorCode.POWERSHELL_UNSUPPORTED_EXECUTION_POLICY, # pyrefly: ignore[missing-attribute] message=message) @@ -114,7 +114,7 @@ def _LaunchPs(self, op: str, try: return execute.execute_binary( _Powershell(), ['-NoProfile', '-NoLogo', op] + args, ok_result, - self.shell, self.log) + self.shell, self.log) # pyrefly: ignore[bad-argument-type] except execute.Error as e: raise PowerShellExecutionError() from e @@ -212,7 +212,7 @@ def StartShell(self): """Start the PowerShell interpreter.""" try: execute.execute_binary( - _Powershell(), ['-NoProfile', '-NoLogo'], shell=self.shell, - log=self.log) + _Powershell(), ['-NoProfile', '-NoLogo'], shell=self.shell, # pyrefly: ignore[bad-argument-type] + log=self.log) # pyrefly: ignore[bad-argument-type] except execute.Error as e: raise PowerShellExecutionError() from e diff --git a/glazier/lib/registry.py b/glazier/lib/registry.py index ac529993..6be98d18 100644 --- a/glazier/lib/registry.py +++ b/glazier/lib/registry.py @@ -33,7 +33,7 @@ def __init__(self, path: Optional[str] = constants.REG_ROOT): message = (fr'Failed to write to registry: [{path}\{name} = {value}]') super().__init__( - error_code=errors.ErrorCode.REGISTRY_WRITE_ERROR, message=message) + error_code=errors.ErrorCode.REGISTRY_WRITE_ERROR, message=message) # pyrefly: ignore[missing-attribute] class RegistryDeleteError(Error): @@ -41,7 +41,7 @@ class RegistryDeleteError(Error): def __init__(self, name: str, path: Optional[str]): message = (fr'Failed to delete registry key: [{path}\{name}]') super().__init__( - error_code=errors.ErrorCode.REGISTRY_DELETE_ERROR, message=message) + error_code=errors.ErrorCode.REGISTRY_DELETE_ERROR, message=message) # pyrefly: ignore[missing-attribute] def get_value(name: str, @@ -64,7 +64,7 @@ def get_value(name: str, """ try: reg = registry.Registry(root_key=root) - value = reg.GetKeyValue(key_path=path, key_name=name, use_64bit=use_64bit) + value = reg.GetKeyValue(key_path=path, key_name=name, use_64bit=use_64bit) # pyrefly: ignore[bad-argument-type] if value: if log: logging.debug(r'Got registry value: %s:\%s\%s = %s.', root, path, name, @@ -97,9 +97,9 @@ def set_value(name: str, try: reg = registry.Registry(root_key=root) reg.SetKeyValue( - key_path=path, + key_path=path, # pyrefly: ignore[bad-argument-type] key_name=name, - key_value=value, + key_value=value, # pyrefly: ignore[bad-argument-type] key_type=reg_type, use_64bit=use_64bit) if log: @@ -186,7 +186,7 @@ def remove_value(name: str, """ try: reg = registry.Registry(root_key=root) - reg.RemoveKeyValue(key_path=path, key_name=name, use_64bit=use_64bit) + reg.RemoveKeyValue(key_path=path, key_name=name, use_64bit=use_64bit) # pyrefly: ignore[bad-argument-type] if log: logging.debug(r'Removed registry key: %s:\%s\%s', root, path, name) except registry.RegistryError as e: diff --git a/glazier/lib/resources.py b/glazier/lib/resources.py index 1ea53cef..5d97a2fa 100644 --- a/glazier/lib/resources.py +++ b/glazier/lib/resources.py @@ -33,7 +33,7 @@ class FileNotFound(Error): def __init__(self, path: str): super().__init__( - error_code=errors.ErrorCode.FILE_NOT_FOUND, + error_code=errors.ErrorCode.FILE_NOT_FOUND, # pyrefly: ignore[missing-attribute] message=f'The following path does not exist: {path}') @@ -60,7 +60,7 @@ def GetResourceFileName(self, file_name): FileNotFound: No file exists at the determined path. """ file_name = file_name.strip('/') - path = os.path.join(self._path, file_name) + path = os.path.join(self._path, file_name) # pyrefly: ignore[no-matching-overload] if os.path.exists(path): return path diff --git a/glazier/lib/spec/spec.py b/glazier/lib/spec/spec.py index 215db90d..f9f7d7a5 100644 --- a/glazier/lib/spec/spec.py +++ b/glazier/lib/spec/spec.py @@ -36,7 +36,7 @@ class UnknownSpec(Error): def __init__(self, spec: str): super().__init__( - error_code=errors.ErrorCode.UNKNOWN_SPEC, + error_code=errors.ErrorCode.UNKNOWN_SPEC, # pyrefly: ignore[missing-attribute] message=f'Unknown spec: {spec}') diff --git a/glazier/lib/splice.py b/glazier/lib/splice.py index aaf15e54..85716730 100644 --- a/glazier/lib/splice.py +++ b/glazier/lib/splice.py @@ -33,7 +33,7 @@ class IdentityError(Error): def __init__(self, prop: str): super().__init__( - error_code=errors.ErrorCode.SPLICE_IDENTITY_ERROR, + error_code=errors.ErrorCode.SPLICE_IDENTITY_ERROR, # pyrefly: ignore[missing-attribute] message=f'Error while determining {prop}') @@ -41,7 +41,7 @@ class DomainJoinError(Error): def __init__(self, attempts: int): super().__init__( - error_code=errors.ErrorCode.DOMAIN_JOIN_FAILURE, + error_code=errors.ErrorCode.DOMAIN_JOIN_FAILURE, # pyrefly: ignore[missing-attribute] message=f'Failed to join domain after {attempts} attempt(s).') diff --git a/glazier/lib/stage.py b/glazier/lib/stage.py index b65cf47c..f8dc2baa 100644 --- a/glazier/lib/stage.py +++ b/glazier/lib/stage.py @@ -47,7 +47,7 @@ class ExpirationError(Error): def __init__(self, stage_id: int): super().__init__( - error_code=errors.ErrorCode.STAGE_EXPIRATION_ERROR, + error_code=errors.ErrorCode.STAGE_EXPIRATION_ERROR, # pyrefly: ignore[missing-attribute] message=f'Active stage {stage_id} has expired') @@ -55,15 +55,15 @@ class InvalidStartTimeError(Error): def __init__(self, stage_id: int): super().__init__( - error_code=errors.ErrorCode.STAGE_INVALID_START_TIME_ERROR, + error_code=errors.ErrorCode.STAGE_INVALID_START_TIME_ERROR, # pyrefly: ignore[missing-attribute] message=f'Stage {stage_id} does not contain a valid start time.') class InvalidStageIdError(Error): - def __init__(self, stage_id_type: type(type)): + def __init__(self, stage_id_type: type(type)): # pyrefly: ignore[invalid-annotation] super().__init__( - error_code=errors.ErrorCode.STAGE_INVALID_ID_ERROR, + error_code=errors.ErrorCode.STAGE_INVALID_ID_ERROR, # pyrefly: ignore[missing-attribute] message=f'Invalid stage ID type; got: {stage_id_type}, want: int') @@ -71,7 +71,7 @@ class ExitError(Error): def __init__(self, stage_id: int): super().__init__( - error_code=errors.ErrorCode.STAGE_EXIT_ERROR, + error_code=errors.ErrorCode.STAGE_EXIT_ERROR, # pyrefly: ignore[missing-attribute] message=f'Error while exiting stage: {stage_id}') @@ -79,7 +79,7 @@ class UpdateError(Error): def __init__(self, stage_id: int): super().__init__( - error_code=errors.ErrorCode.STAGE_UPDATE_ERROR, + error_code=errors.ErrorCode.STAGE_UPDATE_ERROR, # pyrefly: ignore[missing-attribute] message=f'Error while updating stage: {stage_id}') diff --git a/glazier/lib/terminator.py b/glazier/lib/terminator.py index 6b5883df..3d6e19ba 100644 --- a/glazier/lib/terminator.py +++ b/glazier/lib/terminator.py @@ -78,6 +78,7 @@ def log_and_exit(build_info: buildinfo.BuildInfo, # haven't seen before. Direct the user to the default error code # documentation. else: + # pyrefly: ignore[missing-attribute] string += (f' 1. {exception}\n' f' Troubleshooting: ' f'{constants.HELP_URI}#{errors.ErrorCode.DEFAULT}\n\n') diff --git a/glazier/lib/test_utils.py b/glazier/lib/test_utils.py index df0cc4bb..d091f352 100644 --- a/glazier/lib/test_utils.py +++ b/glazier/lib/test_utils.py @@ -57,7 +57,7 @@ def _exception_validation_predicate(exception): # implementation somewhere. glazier_errors = errors.get_glazier_error_lineage(exception) for glazier_error in glazier_errors: - if glazier_error.error_code == errors.ErrorCode.DEFAULT: + if glazier_error.error_code == errors.ErrorCode.DEFAULT: # pyrefly: ignore[missing-attribute] return False return True diff --git a/glazier/lib/timers.py b/glazier/lib/timers.py index 32ad3371..205035a5 100644 --- a/glazier/lib/timers.py +++ b/glazier/lib/timers.py @@ -38,7 +38,7 @@ def __init__(self, value: str): message = (f'Failed to set Glazier timer: [{name} = {value}]') super().__init__( - error_code=errors.ErrorCode.SET_TIMER_ERROR, message=message) + error_code=errors.ErrorCode.SET_TIMER_ERROR, message=message) # pyrefly: ignore[missing-attribute] class Timers(object): @@ -54,7 +54,7 @@ def Get(self, name: str) -> Optional['datetime.datetime']: A specific named datetime value if stored, or None """ timer = registry.get_value(f'TIMER_{name}', path=TIMERS_PATH) - return datetime.datetime.strptime(timer, '%Y-%m-%d %H:%M:%S.%f%z') + return datetime.datetime.strptime(timer, '%Y-%m-%d %H:%M:%S.%f%z') # pyrefly: ignore[bad-argument-type] def GetAll(self) -> Optional[Dict[str, 'datetime.datetime']]: """Get the dictionary of all stored timers. diff --git a/glazier/lib/title.py b/glazier/lib/title.py index f2875c36..ed5c1714 100644 --- a/glazier/lib/title.py +++ b/glazier/lib/title.py @@ -35,7 +35,7 @@ class CannotSetConsoleTitleError(Error): def __init__(self): super().__init__( - error_code=errors.ErrorCode.CANNOT_SET_CONSOLE_TITLE, + error_code=errors.ErrorCode.CANNOT_SET_CONSOLE_TITLE, # pyrefly: ignore[missing-attribute] message='Failed to set console title')