diff --git a/django_depmod/__init__.py b/django_depmod/__init__.py index 827e0f8d24fa82847f70a302fead73d1d7870a6c..9b8db79eb6ff6337e24691ee888ad6ef110b5a37 100644 --- a/django_depmod/__init__.py +++ b/django_depmod/__init__.py @@ -21,7 +21,7 @@ def order_model_dependencies( order: Optional[list[Model]] = None, seen: Optional[set[Model]] = None, ) -> list[Model]: - """Order a list of models by their dependenceis on wach other. + """Order a list of models by their dependencies on wach other. As input, a model graph as a dictionary with origin models as keys and sets of target models as values is expected, along with an optional list of models @@ -69,10 +69,10 @@ def build_model_graph( ) -> dict[Model, set[Model]]: """Determines a graph of model dependencies by looking at foreign keys. - As input, a list of models to determien the graph for is expected. The other arguments + As input, a list of models to determine the graph for is expected. The other arguments control the mode of operation: - closed - Only include dependenceis in the input list; ignore all other models found + closed - Only include dependencies in the input list; ignore all other models found ignore_m2m - Do not consider many-to-many fields ignore_allow_null - Do not consider nullable foreign keys @@ -111,21 +111,21 @@ def resolve_model_dependencies( graph, then resolves it into a strict order. The other arguments control the mode of operation: - closed - Only include dependenceis in the input list; ignore all other models found + closed - Only include dependencies in the input list; ignore all other models found perfect - The order must be perfect, including all models If perfect is set to True, a strict order without any circular dependencies must be determined on first try. If perfect is set to False, a best effort is made to construct an order, by - trying several strategies, getting mroe relaxed every time: + trying several strategies, getting more relaxed every time: 1. Perfect order 2. Ignore many-to-many relationships (these can always be NULL) 3. Ignore all nullable fields Returns an ordered list of models if perfect is True, or a tuple with an ordered - list of models and a set of iperfectly ordered models. + list of models and a set of imperfectly ordered models. (If imperfect resolution was done and the set of imperfectly ordered models is non-empty, any action involving these models can be gracefully retried.)