---
sidebar:
  label: roboto.paths
  order: 17
title: roboto.paths
---
## Module Contents

### DOTFILE_PATTERN

```python
roboto.paths.DOTFILE_PATTERN = '.**'
```

`from roboto.paths import DOTFILE_PATTERN`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/paths.py#L21-L21)

Git wildmatch pattern for a path with any component that starts with a dot, e.g. `.env` or `.cache/run.bag`. Triggers never run on these files, and file listings leave them out.

### excludespec_from_patterns()

```python
def roboto.paths.excludespec_from_patterns(
    exclude_patterns: Optional[collections.abc.Iterable[str]] = None,
) -> Optional[pathspec.PathSpec]
```

`from roboto.paths import excludespec_from_patterns`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/paths.py#L49-L55)

Transform a list of Git wildmatch patterns into a pathspec.PathSpec.

**Parameters**

- **exclude_patterns** (`Optional[collections.abc.Iterable[str]]`)

**Returns**

- `Optional[pathspec.PathSpec]`

### is_dotfile_path()

```python
def roboto.paths.is_dotfile_path(path: str) -> bool
```

`from roboto.paths import is_dotfile_path`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/paths.py#L105-L107)

Whether `path` matches [`DOTFILE_PATTERN`](/reference/python-sdk/roboto/paths#roboto.paths.DOTFILE_PATTERN).

**Parameters**

- **path** (`str`)

**Returns**

- `bool`

### join_within()

```python
def roboto.paths.join_within(
    directory: pathlib.Path,
    relative_path: str,
) -> pathlib.Path
```

`from roboto.paths import join_within`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/paths.py#L26-L37)

Return `directory / relative_path`, refusing a path that resolves outside `directory`.

A file's stored path comes from the server and is not trusted to stay inside the directory it is written to.

**Parameters**

- **directory** (`pathlib.Path`)
- **relative_path** (`str`)

**Raises**

- [`RobotoIllegalArgumentException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoIllegalArgumentException): `relative_path` is absolute or climbs out of `directory`.

**Returns**

- `pathlib.Path`

### path_matches()

```python
def roboto.paths.path_matches(
    path: str,
    include_patterns: Optional[collections.abc.Iterable[str]] = None,
    exclude_patterns: Optional[collections.abc.Iterable[str]] = None,
) -> bool
```

`from roboto.paths import path_matches`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/paths.py#L67-L79)

Does the given path match the given include pattern(s) and not match the given exclude pattern(s)?

**Parameters**

- **path** (`str`)
- **include_patterns** (`Optional[collections.abc.Iterable[str]]`)
- **exclude_patterns** (`Optional[collections.abc.Iterable[str]]`)

**Returns**

- `bool`

### path_matches_specs()

```python
def roboto.paths.path_matches_specs(
    path: str,
    include_spec: Optional[pathspec.PathSpec] = None,
    exclude_spec: Optional[pathspec.PathSpec] = None,
) -> bool
```

`from roboto.paths import path_matches_specs`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/paths.py#L82-L99)

[`path_matches()`](/reference/python-sdk/roboto/paths#roboto.paths.path_matches) for patterns already compiled with [`pathspec_from_patterns()`](/reference/python-sdk/roboto/paths#roboto.paths.pathspec_from_patterns), for callers that match many paths against the same patterns.

**Parameters**

- **path** (`str`)
- **include_spec** (`Optional[pathspec.PathSpec]`)
- **exclude_spec** (`Optional[pathspec.PathSpec]`)

**Returns**

- `bool`

### path_to_pattern()

```python
def roboto.paths.path_to_pattern(path: str) -> str
```

`from roboto.paths import path_to_pattern`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/paths.py#L40-L46)

Transform a literal path into a Git wildmatch pattern that matches that literal path.

**Parameters**

- **path** (`str`)

**Returns**

- `str`

### pathspec_from_patterns()

```python
def roboto.paths.pathspec_from_patterns(
    patterns: collections.abc.Iterable[str],
) -> pathspec.PathSpec
```

`from roboto.paths import pathspec_from_patterns`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/paths.py#L58-L64)

Transform a list of Git wildmatch patterns into a pathspec.PathSpec.

**Parameters**

- **patterns** (`collections.abc.Iterable[str]`)

**Returns**

- `pathspec.PathSpec`

### pattern_to_like_value()

```python
def roboto.paths.pattern_to_like_value(pattern: str) -> str
```

`from roboto.paths import pattern_to_like_value`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/paths.py#L110-L111)

**Parameters**

- **pattern** (`str`)

**Returns**

- `str`

### patterns_to_condition_group()

```python
def roboto.paths.patterns_to_condition_group(
    patterns: collections.abc.Iterable[str],
    path_field_name: str,
    comparator: roboto.query.Comparator,
    operator: roboto.query.ConditionOperator,
) -> roboto.query.ConditionGroup
```

`from roboto.paths import patterns_to_condition_group`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/paths.py#L114-L137)

Transform a list of Git wildmatch patterns into a ConditionGroup.

`patterns` must be non-empty. An empty iterable yields a zero-condition group, which `ConditionGroup` rejects with a `ValueError`; callers treat an empty pattern list as no filter and skip this call rather than passing it through.

**Parameters**

- **patterns** (`collections.abc.Iterable[str]`)
- **path_field_name** (`str`)
- **comparator** (`roboto.query.Comparator`)
- **operator** (`roboto.query.ConditionOperator`)

**Returns**

- `roboto.query.ConditionGroup`
