-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/vectorset : nouvelle implémentation suite à la point review datant du 22-09-2025 avec Théo #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
…Théo => implémenter les attributs, constructeurs, propriétés et méthodes précisées comme dans le ticket
…ples de fichiers vecteurs
…e fichiers d'entrée vecteur contenus dans le dossier "tests/fixtures"
… à revoir dans le PR du 22-09-2025
…nt à revoir car de nouvelles fonctions ont été rajoutées suite à la revue de code PR du 22-09-2025 par Théo
… globalité suite ajout de nouvelles fonctions
…s en entrée du programme avec "ogr.UseExceptions()" à la ligne 42
… la fonction serializable + revue de from_file comme dans test.py
…% suite revue du code de 'vector.py'
…r_calls_put_data_str()' et 'test_vector_from_file_raises_storageerror_on_none_datasource()'
…ises_from_formaterror_on_jsondecodeerror()' + tester que la sortie de la property de srs est bien une liste
…es méthodes de test
…prime à la fin du test
…ression import module 'sys'
…es tests passent avec une couverture globale à 94%
… est sérializable
…feature/vectorset
…tion de tests manquants
- passage du CHANGELOG au format keepachangelog - déplacement des fichiers de tests dans les dossiers fixtures - migration de fix-encoding-pragma vers pyupgrade dans le pre commit
d2fac70 to
13e09b9
Compare
Dolite
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retours généraux :
- La documentation doit être faite en docstring google pour être homogène avec les autres modules
- Les autres modules ne loggent rien, pour laisser aux projets appelant la main sur la quantité d'information à afficher. Il ne faut pas faire de print
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retours généraux :
- La documentation doit être faite en docstring google pour être homogène avec les autres modules
- Il faudrait documenter les exceptions possibles dans les fonctions, au moins les plus importantes
- Les autres modules ne loggent rien, pour laisser aux projets appelant la main sur la quantité d'information à afficher. Il ne faut pas faire de print.
- L'initialisation des attributs peut se faire directement dans le init, sans passer par des attributs de classe (__path et __tables dans Vector par exemple)
- Si tu veux mettre des exemples d'usage d'une fonction, mets le dans la doc de cette fonction, dans une section
Example(comme dans list_generator de la classe Pyramid par exemple)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done !
| else: | ||
| dataSource = ogr.Open(get_osgeo_path(path), 0) | ||
| if datasource is None: | ||
| raise StorageError("FILE", f"Cannot open vector file/object {working_path}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mieux vaut mettre dans l'erreur le chemin d'origine, pas celui osgeo (sinon l'utlisateurice risque de ne pas comprendre d'où vient cette valeur qui n'est pas celle de son côté)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done !
src/rok4/vector.py
Outdated
|
|
||
| layer = datasource.GetLayer(i) | ||
| name = layer.GetName() | ||
| count = layer.GetFeatureCount() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ne pas forcer le calcul du nombre de features pour éviter des délais trop long sur les gros fichiers (mettre le premier paramètre à 0 a priori)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done !
| path (str): path to the file/object | ||
| bbox (Tuple[float, float, float, float]): bounding rectange in the data projection | ||
| layers (List[Tuple[str, int, List[Tuple[str, str]]]]) : Vector layers with their name, their number of objects and their attributes | ||
| def from_parameters(cls, path: str, tables: Dict[str, "Table"]) -> "Vector": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Le paramètre tables est un simple dictionnaire, chargé depuis le descripteur JSON. Il faut faire dans cette fonction la boucle d'appel au constructeur Table pour créer les instances à partir des informations dans le dictionnaire.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
making a loop for calling the Table constructor has been done !
src/rok4/vector.py
Outdated
| print(self.tables) | ||
| # for each table in the vector data, we get its serializable version | ||
| for table in self.tables: | ||
| serialization["tables"].append(Table.serializable.fget(self.tables[table])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
serializable doit être une priopriété de l'instance Table (pas de fget du coup)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok !
src/rok4/vector.py
Outdated
| return serialization | ||
|
|
||
|
|
||
| if __name__ == "__main__": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pas besoin de ça dans une lib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok ! done !
…rint + add raises exceptions for the most important functions + initialize attributes directly in the __init__ constructor + serializable is a property Table instance + make in function from_parameters() the call loop to Table constructor to create the instances from data into the dictionary
…feature/vectorset
…feature/vectorset
…arameters()' function
headers, docstring et commentaires rédigés tout en anglais + couverture globale des tests unitaires et d'intégration à 94%