Compare commits

..

3 Commits

Author SHA1 Message Date
Chuck Driesler 7158d0576d Update main.yml 2025-04-23 00:45:34 +01:00
Jonathon Broughton bb87a7b932 Newmain (#61)
* Added over the top levels of documentation for future developers

* Update README with clearer instructions

- Updated the template spreadsheet link.
- Changed steps for rule publishing and automation creation.
- Improved formatting of supported predicates table.
- Added a new support contact method via community forum.
2025-03-01 10:26:01 +00:00
Jonathon Broughton f1c4e65d72 Readmeimprovement (#60)
* Added over the top levels of documentation for future developers

* Update README with clearer instructions

- Updated the template spreadsheet link.
- Changed steps for rule publishing and automation creation.
- Improved formatting of supported predicates table.
- Added a new support contact method via community forum.
2025-03-01 10:22:44 +00:00
4 changed files with 1 additions and 50 deletions
+1
View File
@@ -44,3 +44,4 @@ jobs:
speckle_function_id: ${{ secrets.SPECKLE_FUNCTION_ID }}
speckle_function_input_schema_file_path: ${{ env.FUNCTION_SCHEMA_FILE_NAME }}
speckle_function_command: 'python -u main.py run'
speckle_function_recommended_memory_mi: 5000
-1
View File
@@ -17,5 +17,4 @@ PREDICATE_METHOD_MAP = {
"identical to": PropertyRules.is_identical_value.__name__,
"contains": PropertyRules.is_parameter_value_containing.__name__,
"does not contain": PropertyRules.is_parameter_value_not_containing.__name__,
"is set": PropertyRules.is_parameter_value_not_empty.__name__,
}
-32
View File
@@ -890,35 +890,3 @@ class PropertyRules:
return PropertyRules.compare_values(
parameter_value, value_to_match, case_sensitive=True, tolerance=0, allow_yes_no_bools=False, use_exact=True
)
@staticmethod
def is_parameter_value_not_empty(speckle_object: Base, parameter_name: str) -> bool:
"""Checks if parameter exists and has a non-empty value.
Args:
speckle_object: The Speckle object to check
parameter_name: Name of the parameter to check
Returns:
bool: True if parameter exists and has a non-empty value
"""
# Get the parameter value
parameter_value = PropertyRules.get_parameter_value(speckle_object, parameter_name)
# Check if parameter exists
if parameter_value is None:
return False
# Check if value is an empty string
if isinstance(parameter_value, str) and parameter_value.strip() == "":
return False
# Check if value is an empty list or collection
if hasattr(parameter_value, "__len__") and len(parameter_value) == 0:
return False
# Additional check for "None" string which can sometimes appear in exports
if isinstance(parameter_value, str) and parameter_value.lower() == "none":
return False
return True
-17
View File
@@ -415,20 +415,3 @@ class TestParameterHandling:
"""Test negative substring matching on parameter values."""
v2_obj, _ = test_objects
assert PropertyRules.is_parameter_value_not_containing(v2_obj, param_name, substring) == expected_result
@pytest.mark.parametrize(
"param_name, expected_result",
[
("category", True), # Parameter exists with non-empty value
("family", True), # Parameter exists with non-empty value
("non_existent_param", False), # Parameter doesn't exist
# The following would require setup with empty values
# ("empty_string_param", False), # Parameter exists but has empty string value
# ("none_string_param", False), # Parameter exists but has "None" string value
],
)
def test_parameter_not_empty(self, test_objects, param_name, expected_result):
"""Test 'not empty' check on parameter values."""
v2_obj, _ = test_objects
assert PropertyRules.is_parameter_value_not_empty(v2_obj, param_name) == expected_result