collaboration.util module¶
Class |
Description |
|---|---|
Lazily loaded objects (but FFI) Pretend this class is templated, because the C++ version is |
Function |
Description |
|---|---|
Function that just returns True, used as default for callbacks |
|
Split a single progress function into equally sized subparts. This function takes the original… |
|
Wraps a conflict handler function in a ConflictHandler object so you can be lazy and just use a… |
|
Wraps a changeset naming function in a ctypes function for passing to the FFI |
|
Wraps a progress function in a ctypes function for passing to the FFI |
LazyT¶
- class LazyT[source]¶
Bases:
objectLazily loaded objects (but FFI) Pretend this class is templated, because the C++ version is
nop¶
split_progress¶
- split_progress(progress_func: Callable[[int, int], bool] | None, subpart: int, subpart_weights: List[float]) Callable[[int, int], bool][source]¶
Split a single progress function into equally sized subparts. This function takes the original progress function and returns a new function whose signature is the same but whose output is shortened to correspond to the specified subparts.
The length of a subpart is proportional to the sum of all the weights. E.g. If subpart = 1 and subpartWeights = { 0.25, 0.5, 0.25 }, this will return a function that calls progress_func and maps its progress to the range [0.25, 0.75]
Internally this works by calling progress_func with total = 1000000 and doing math on the current value
- Parameters:
- Returns:
A function that will call progress_func() within a modified progress region
- Return type:
wrap_conflict_handler¶
- wrap_conflict_handler(handler: Callable[[Dict[str, MergeConflict]], bool] | ConflictHandler)[source]¶
Wraps a conflict handler function in a ConflictHandler object so you can be lazy and just use a lambda
- Parameters:
handler (Callable[[Dict[str, MergeConflict]], bool] | ConflictHandler) – Python conflict handler function
- Returns:
Wrapped ConflictHandler object