def positional_members_repr(self, all_args: List[str]) -> None: """ helper function to create repr for BaseRegistryKey common to all subclasses """ all_args.append(utils.quoteme_double(self.top_key)) all_args.append(utils.quoteme_raw_by_type(self.sub_key)) if self.value_name is not None: all_args.append(utils.quoteme_raw_by_type(self.value_name)) if self.value_data is not None: all_args.append(utils.quoteme_raw_by_type(self.value_data))
def optional_named__init__param(self, name, value, default=None): param_repr = None if value != default: value_str = utils.quoteme_raw_by_type( value, PythonBatchCommandBase.config_vars_for_repr) param_repr = f"{name}={value_str}" return param_repr
def progress_msg_self(self): paths = ", ".join( os.path.expandvars(utils.quoteme_raw_by_type(path)) for path in self.paths_to_make) titula = "directory" if len(self.paths_to_make) == 1 else "directories" the_progress_msg = f"Create {titula} {paths}" return the_progress_msg
def repr_own_args(self, all_args: List[str]) -> None: try: all_args.append(utils.quoteme_raw_by_type(self.subprocess_exe)) for arg in self.subprocess_args: all_args.append(utils.quoteme_raw_by_type(arg)) if self.message: all_args.append( f"""message={utils.quoteme_raw_by_type(self.message)}""") if self.ignore_specific_exit_codes: if len(self.ignore_specific_exit_codes, ) == 1: all_args.append( f"""ignore_specific_exit_codes={self.ignore_specific_exit_codes[0]}""" ) else: all_args.append( f"""ignore_specific_exit_codes={self.ignore_specific_exit_codes}""" ) except TypeError as te: pass
def repr_own_args(self, all_args: List[str]) -> None: all_args.append(utils.quoteme_raw_by_type(self.shell_command)) if self.message: all_args.append( f"""message={utils.quoteme_raw_by_type(self.message)}""") if self.ignore_specific_exit_codes: if len(self.ignore_specific_exit_codes, ) == 1: all_args.append( f"""ignore_specific_exit_codes={self.ignore_specific_exit_codes[0]}""" ) else: all_args.append( f"""ignore_specific_exit_codes={self.ignore_specific_exit_codes}""" )
def __repr__(self) -> str: the_repr = "" if any(self.var_values): adjusted_values = list() for val in self.var_values: try: adjusted_values.append(int(val)) except: adjusted_values.append(utils.quoteme_raw_by_type(val)) if len(adjusted_values) == 1: the_repr = f'''config_vars['{self.var_name}'] = {adjusted_values[0]}''' else: values = "".join(('(', ", ".join(str(adj) for adj in adjusted_values), ')')) the_repr = f'''config_vars['{self.var_name}'] = {values}''' else: the_repr = f'''config_vars['{self.var_name}'] = ""''' return the_repr
def __repr__(self) -> str: the_repr = "" if any(self.var_values): need_path_resolving = need_path_resolving_re.match(self.var_name) is not None adjusted_values = list() for val in self.var_values: try: adjusted_values.append(int(val)) except: if need_path_resolving: val = os.fspath(Path(os.path.expandvars(val)).resolve()) adjusted_values.append(utils.quoteme_raw_by_type(val)) if len(adjusted_values) == 1: the_repr = f'''{self.var_name} = {adjusted_values[0]}''' else: values = "".join(('(', ", ".join(str(adj) for adj in adjusted_values), ')')) the_repr = f'''{self.var_name} = {values}''' else: the_repr = f'''{self.var_name} = ""''' return the_repr
def repr_own_args(self, all_args: List[str]) -> None: all_args.append(utils.quoteme_raw_by_type(self.folder_to_scan)) all_args.append(utils.quoteme_raw_by_type(self.out_file))
def repr_own_args(self, all_args: List[str]) -> None: all_args.append(utils.quoteme_raw_by_type(self.path)) for a_flag in self.flags: all_args.append(utils.quoteme_raw_by_type(a_flag))
def repr_own_args(self, all_args: List[str]) -> None: all_args.append(utils.quoteme_raw_by_type(self.stage_name)) all_args.append(utils.quoteme_raw_by_type(self.new_path)) for title in self.titles: all_args.append(utils.quoteme_raw_by_type(title))
def named__init__param(self, name, value): value_str = utils.quoteme_raw_by_type( value, PythonBatchCommandBase.config_vars_for_repr) param_repr = f"{name}={value_str}" return param_repr
def repr_own_args(self, all_args: List[str]) -> None: all_args.append(self.exception_type_name) all_args.append(utils.quoteme_raw_by_type(self.exception_message))
def repr_own_args(self, all_args: List[str]) -> None: all_args.append(utils.quoteme_raw_by_type(self.var_name))
def repr_own_args(self, all_args: List[str]) -> None: all_args.append(utils.quoteme_raw_by_type(self.what_to_unwzip)) if self.where_to_put_unwzip: all_args.append(utils.quoteme_raw_by_type( self.where_to_put_unwzip))
def repr_own_args(self, all_args: List[str]) -> None: all_args.extend( utils.quoteme_raw_by_type(path) for path in self.paths_to_make) if not self.remove_obstacles: all_args.append(f"remove_obstacles={self.remove_obstacles}")
def repr_own_args(self, all_args: List[str]) -> None: all_args.append(utils.quoteme_raw_by_type(self.python_file)) if self.config_files: all_args.append(utils.quoteme_raw_by_type(self.config_files)) if not self.reuse_db: all_args.append(f"reuse_db={self.reuse_db}")
def repr_own_args(self, all_args: List[str]) -> None: all_args.append(utils.quoteme_raw_by_type(self.config_file)) all_args.append(f'''shell={self.shell}''')
def repr_own_args(self, all_args: List[str]) -> None: all_args.append(utils.quoteme_raw_by_type(self.url)) all_args.append(utils.quoteme_raw_by_type(self.path)) all_args.append(utils.quoteme_raw_by_type(self.checksum))
def unnamed__init__param(self, value): value_str = utils.quoteme_raw_by_type(value) return value_str
def repr_own_args(self, all_args: List[str]) -> None: all_args.append(utils.quoteme_raw_by_type(self.path_to_folder)) for pattern in self.patterns: all_args.append(utils.quoteme_raw_by_type(pattern))
def named__init__param(self, name, value): value_str = utils.quoteme_raw_by_type(value) param_repr = f"{name}={value_str}" return param_repr
def repr_own_args(self, all_args: List[str]) -> None: all_args.append(utils.quoteme_raw_by_type(self.path_to_py_batch))
def optional_named__init__param(self, name, value, default=None): param_repr = None if value != default: value_str = utils.quoteme_raw_by_type(value) param_repr = f"{name}={value_str}" return param_repr
def repr_own_args(self, all_args: List[str]) -> None: all_args.append(utils.quoteme_raw_by_type(self.stage_name)) if self.stage_extra: all_args.append(utils.quoteme_raw_by_type(self.stage_extra))
def unnamed__init__param(self, value): value_str = utils.quoteme_raw_by_type( value, PythonBatchCommandBase.config_vars_for_repr) return value_str