use common rst syntax in doc-strings

This commit is contained in:
Andrej730
2025-11-17 14:20:54 +05:00
parent 51e2e7cd82
commit 29ab446f8c
12 changed files with 85 additions and 134 deletions
@@ -319,13 +319,11 @@ def stream2(path: Union[Path, str], mmap: bool = False, page_size: int = 0):
"""Streams the content of a file path from disk, yielding each instance
as a dictionary.
Args:
path (Union[Path, str]): input file path
mmap (bool): open the file contents using memory mapping
page_size (int): open file in python and feed chunks to the parser
:param path: Input file path
:param mmap: Open the file contents using memory mapping
:param page_size: Open file in python and feed chunks to the parser.
Yields:
dict: entity instance dictionaries
:yield: Entity instance dictionaries
"""
if page_size:
import builtins
@@ -359,11 +357,8 @@ def stream2_from_string(data: str) -> Generator[dict]:
"""Streams the content of a file path from string, yielding each instance
as a dictionary.
Args:
data (str): input data
Yields:
dict: entity instance dictionaries
:param data: Input data string
:yield: entity instance dictionaries
"""
streamer = ifcopenshell_wrapper.stream_from_string(data)
while streamer:
@@ -376,9 +371,8 @@ def convert_path_to_rocksdb(ifcspf_path: Union[Path, str], rocksdb_path: Union[P
RocksDB encoding. RocksDB is an embedded key-value store that allows
partial reads and is therefore more memory efficient with larger files.
Args:
ifcspf_path (Union[Path, str]): Input file path - needs to exist
rocksdb_path (Union[Path, str]): RocksDB file path (directory) - may exist, but result may then be invalid
:param ifcspf_path: Input file path - needs to exist
:param rocksdb_path: RocksDB file path (directory) - may exist, but result may then be invalid
"""
ser = ifcopenshell_wrapper.RocksDbSerializer(str(ifcspf_path), str(rocksdb_path), True)
ser.finalize()
@@ -466,8 +466,7 @@ class entity_instance:
def is_entity(self) -> bool:
"""Tests whether the instance is an entity type as opposed to a simple data type.
Returns:
bool: True if the instance is an entity
:return: True if the instance is an entity
"""
schema_name = self.wrapped_data.is_a(True).split(".")[0]
decl = ifcopenshell_wrapper.schema_by_name(schema_name).declaration_by_name(self.is_a())
@@ -499,13 +498,11 @@ class entity_instance:
return op(a, b)
TypeError: '<' not supported between instances of 'int' and 'str'
Args:
other (_type_): Right hand side (or lhs when reverse = True)
op (_type_): The comparison operator (likely from the operator module)
reverse (bool, optional): When true swaps lhs and rhs. Defaults to False.
:param other: Right hand side (or lhs when reverse = True)
:param op: The comparison operator (likely from the operator module)
:param reverse: When true swaps lhs and rhs. Defaults to False.
Returns:
bool: The comparison predicate applied to self and other
:return: bool: The comparison predicate applied to self and other
"""
if isinstance(other, entity_instance):
@@ -189,11 +189,9 @@ def get_cost_items_for_product(product: ifcopenshell.entity_instance) -> list[if
"""
Returns a list of cost items related to the given product.
Args:
product: An object of class IfcProduct representing a product.
:param product: An object of class IfcProduct representing a product.
Returns:
A list of IfcCostItem objects representing the cost items related to the product.
:return: A list of IfcCostItem objects representing the cost items related to the product.
"""
cost_items = []
for assignment in product.HasAssignments:
@@ -367,14 +367,12 @@ def get_tasks_for_product(
"""
Get all tasks assigned to or referenced by the given product.
Args:
product: An object that is assigned tasks or references tasks.
schedule: An optional string representing the schedule name to filter tasks by.
:param product: An object that is assigned tasks or references tasks.
:param schedule: An optional string representing the schedule name to filter tasks by.
Returns:
A tuple of two lists:
- The first list contains all tasks assigned to the product.
- The second list contains all tasks referenced by the product that are part of the given schedule.
:return: A tuple of two lists:
- The first list contains all tasks assigned to the product.
- The second list contains all tasks referenced by the product that are part of the given schedule.
"""
inputs = [
assignement.RelatingProcess