> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encord.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Objects.spaces.range space.range space

#### RangeClassificationOverlapStrategy

For now, classifications for range spaces are always global

## RangeSpace Objects

```python theme={"dark"}
class RangeSpace(Space[_RangeObjectAnnotation, _GlobalClassificationAnnotation,
                       RangeClassificationOverlapStrategy])
```

Abstract base class for spaces that manage one dimensional range-based annotations.

This class extracts common logic for managing object and classification instances
across ranges.

#### put\_object\_instance

```python theme={"dark"}
def put_object_instance(object_instance: ObjectInstance,
                        ranges: Ranges | Range,
                        *,
                        on_overlap: RangeOverlapStrategy = "error",
                        created_at: Optional[datetime] = None,
                        created_by: Optional[str] = None,
                        last_edited_at: Optional[datetime] = None,
                        last_edited_by: Optional[str] = None,
                        confidence: Optional[float] = None,
                        manual_annotation: Optional[bool] = None) -> None
```

Add an object instance to specific ranges in the space (audio, text, or HTML).

**Arguments**:

* `object_instance` - The object instance to add to the space.
* `ranges` - Time ranges where the object should appear. Can be:
  * A single Range object (Range)
  * A list of Range objects for multiple ranges (List\[Range])
* `on_overlap` - Strategy for handling existing annotations on overlapping ranges.
  * "error" (default): Raises an error if annotation already exists on overlapping ranges.
  * "merge": Adds the object to new ranges while keeping existing annotations.
  * "replace": Removes object from existing ranges before adding to new ranges.
* `created_at` - Optional timestamp when the annotation was created.
* `created_by` - Optional identifier of who created the annotation.
* `last_edited_at` - Optional timestamp when the annotation was last edited.
* `last_edited_by` - Optional identifier of who last edited the annotation.
* `confidence` - Optional confidence score for the annotation (0.0 to 1.0).
* `manual_annotation` - Optional flag indicating if this was manually annotated.

**Raises**:

* `LabelRowError` - If ranges are invalid or if annotation already exists when on\_overlap="error".

#### remove\_object\_instance\_from\_range

```python theme={"dark"}
def remove_object_instance_from_range(object_instance: ObjectInstance,
                                      ranges: Ranges | Range) -> Ranges
```

Remove an object instance from specific ranges in the space.

If the object is removed from all ranges, it will be completely removed from the space.

**Arguments**:

* `object_instance` - The object instance to remove from ranges.
* `ranges` - Ranges to remove the object from. Can be:
  * A single Range object (Range)
  * A list of Range objects for multiple ranges (List\[Range])

**Returns**:

* `Ranges` - List of ranges where the object was actually removed.
  Empty if the object didn't exist on any of the specified ranges.

#### put\_classification\_instance

```python theme={"dark"}
def put_classification_instance(
        classification_instance: ClassificationInstance,
        *,
        on_overlap: Optional[RangeClassificationOverlapStrategy] = "error",
        created_at: Optional[datetime] = None,
        created_by: Optional[str] = None,
        last_edited_at: Optional[datetime] = None,
        last_edited_by: Optional[str] = None,
        confidence: Optional[float] = None,
        manual_annotation: Optional[bool] = None) -> None
```

Add a classification instance to the space (audio, text, or HTML).
Currently classification instances exist on the entire space.

**Arguments**:

* `classification_instance` - The classification instance to add to the space.
* `on_overlap` - Strategy for handling existing classifications.
  * "error" (default): Raises an error if classification of the same ontology item already exists.
  * "replace": Overwrites existing classifications.
* `created_at` - Optional timestamp when the annotation was created.
* `created_by` - Optional identifier of who created the annotation.
* `last_edited_at` - Optional timestamp when the annotation was last edited.
* `last_edited_by` - Optional identifier of who last edited the annotation.
* `confidence` - Optional confidence score for the annotation (0.0 to 1.0).
* `manual_annotation` - Optional flag indicating if this was manually annotated.

**Raises**:

* `LabelRowError` - If classification already exists when on\_overlap="error".

#### get\_object\_ranges

```python theme={"dark"}
def get_object_ranges(object_instance: ObjectInstance) -> Ranges
```

Get the ranges for an object instance on this space.

**Arguments**:

* `object_instance` - The object instance to get the ranges for.

**Returns**:

* `Ranges` - The ranges for the object instance on this space.

**Raises**:

* `LabelRowError` - If the object instance is not on this space.

#### remove\_object\_instance

```python theme={"dark"}
def remove_object_instance(object_hash: str) -> Optional[ObjectInstance]
```

Remove an object instance from all ranges in the space.

This completely removes the object and all associated data from the space.

**Arguments**:

* `object_hash` - The hash identifier of the object instance to remove.

**Returns**:

* `Optional[ObjectInstance]` - The removed object instance, or None if the object wasn't found.

#### remove\_classification\_instance

```python theme={"dark"}
def remove_classification_instance(
        classification_hash: str) -> Optional[ClassificationInstance]
```

Remove a classification instance from the space.

This completely removes the classification and all associated data from the space.

**Arguments**:

* `classification_hash` - The hash identifier of the classification instance to remove.

**Returns**:

* `Optional[ClassificationInstance]` - The removed classification instance, or None if the classification wasn't found.
