EVerest / EVerest/cbexigen

Inconsistent Use of is_array Property Across Codebase

Open
#107 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
69
Forks
36
Avg merge
3h 30m
Merged PRs (30d)
1

Description

### Describe the problem

The is_array property is defined in the codebase to determine whether a data type is an array:

```
@property
def is_array(self) -> bool:
# an occurrence of more than 1 marks an array
return self.max_occurs > 1
```

However, in several parts of the code, instead of using particle.is_array, the condition particle.max_occurs > 1 is used directly. This inconsistency can lead to maintenance issues and makes it harder to modify the criteria for what qualifies as an array in the future.

Additionally, I am adapting this project for compatibility with OpenV2G, which considers "unbounded" data types with a max occurrence limited to 1 as arrays of length 1, while cbexigen currently treats them as simple elements. A centralized approach using is_array would facilitate handling such differences.

### Describe your solution

The code should consistently use is_array instead of directly checking max_occurs > 1. This would improve maintainability and make future modifications to array detection easier. If the definition of an array needs to change in the future, having a centralized property will ensure that the change propagates correctly throughout the codebase.

### Additional context

I will send you a pull request with the proposed changes.

Thank you for all your amazing work on this library! :))

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.