Ejemplo n.º 1
0
 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))
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
 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
Ejemplo n.º 5
0
 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}"""
             )
Ejemplo n.º 6
0
 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
Ejemplo n.º 7
0
 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
Ejemplo n.º 8
0
 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))
Ejemplo n.º 9
0
 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))
Ejemplo n.º 10
0
 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))
Ejemplo n.º 11
0
 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
Ejemplo n.º 12
0
 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))
Ejemplo n.º 13
0
 def repr_own_args(self, all_args: List[str]) -> None:
     all_args.append(utils.quoteme_raw_by_type(self.var_name))
Ejemplo n.º 14
0
 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))
Ejemplo n.º 15
0
 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}")
Ejemplo n.º 16
0
 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}")
Ejemplo n.º 17
0
 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}''')
Ejemplo n.º 18
0
 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))
Ejemplo n.º 19
0
 def unnamed__init__param(self, value):
     value_str = utils.quoteme_raw_by_type(value)
     return value_str
Ejemplo n.º 20
0
 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))
Ejemplo n.º 21
0
 def named__init__param(self, name, value):
     value_str = utils.quoteme_raw_by_type(value)
     param_repr = f"{name}={value_str}"
     return param_repr
Ejemplo n.º 22
0
 def repr_own_args(self, all_args: List[str]) -> None:
     all_args.append(utils.quoteme_raw_by_type(self.path_to_py_batch))
Ejemplo n.º 23
0
 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
Ejemplo n.º 24
0
 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))
Ejemplo n.º 25
0
 def unnamed__init__param(self, value):
     value_str = utils.quoteme_raw_by_type(
         value, PythonBatchCommandBase.config_vars_for_repr)
     return value_str