# System utilities


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## Get project root

------------------------------------------------------------------------

### get_project_root

>  get_project_root ()

*Get the project root directory from either notebook or module context*

#### Example usage

``` python
get_project_root()
```

    Path('/home/jelle/code/hopsa')

## Get project name

------------------------------------------------------------------------

### get_project_name

>  get_project_name ()

#### Example usage

``` python
get_project_name()
```

    'hopsa'

## Sanitize names

Remove special characters from names, convert to lowercase, and remove
leading and trailing whitespace. Especially convenient to create
filenames and foldernames that are compatible with most operating
systems, but can also be used to sanitize names for other purposes.

------------------------------------------------------------------------

### sanitize_name

>  sanitize_name (name:str)

*Remove special characters from names, convert to lowercase, and remove
leading and trailing whitespace.*

``` python
"""Test basic sanitization cases"""
test_eq(sanitize_name("My Test Name"), "my_test_name")
test_eq(sanitize_name("  Trim Me  "), "trim_me")
test_eq(sanitize_name("UPPER CASE"), "upper_case")

"""Test with special characters"""
test_eq(sanitize_name("File@Name#123"), "file_name_123")
test_eq(sanitize_name("user@domain.com"), "user_domain_com")
test_eq(sanitize_name("test$%^&*()name"), "test_name")

"""Test with emoticons and unicode characters"""
test_eq(sanitize_name("Happy 😊 Face"), "happy_face")
test_eq(sanitize_name("Thumbs 👍 Up"), "thumbs_up")
test_eq(sanitize_name("Café "), "cafe")
test_eq(sanitize_name("Mötörhead"), "motorhead")

"""Test with multiple spaces and various whitespace characters"""
test_eq(sanitize_name("Too    Many   Spaces"), "too_many_spaces")
test_eq(sanitize_name("New\nLine"), "new_line")
test_eq(sanitize_name("Tab\tSeparated"), "tab_separated")

"""Test edge cases and empty inputs"""
test_eq(sanitize_name(""), "")
test_eq(sanitize_name(" "), "")
test_eq(sanitize_name("!@#$%^"), "")
test_eq(sanitize_name("123"), "123")
test_eq(sanitize_name("a"), "a")
```
