cosmel.util.core module

class cosmel.util.core.ReadOnlyList(data=[])[source]

Bases: collections.abc.Sequence

The read-only list class.

cosmel.util.core.purge_string(chars)[source]
  • Convert to lower cases.
  • Remove special symbols.
  • Remove spaces near non-alphabets.
  • Replace spaces by ‘□’s.
class cosmel.util.core.PurgeString[source]

Bases: object

classmethod sub(chars)[source]
cosmel.util.core.check_contain_chinese(chars)[source]

Check if containing Chinese characters.

cosmel.util.core.glob_files(root, parts=[''])[source]

Glob all files in the directory.

cosmel.util.core.rm_ext_all(path)[source]

Remove all file extension

cosmel.util.core.rm_files(root, parts=[''])[source]

Remove files in the directory.

cosmel.util.core.transform_path(path, old_root, new_root, new_ext=None)[source]

Transform path.

cosmel.util.core.printr(*objects)[source]

Print with ‘\r’.

cosmel.util.core.colored(code, string)[source]

Color string.

cosmel.util.core.pause()[source]

Pause until pressing Enter.

cosmel.util.core.subprocess_run(command, *args, **kwargs)[source]

Print command before calling it.