git = port_obj.host.git(path)
`@memoized` still doesn't support keyword args yet unfortunately. `@functools.*cache` won't work either because it holds onto `self`, preventing GC.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
git = port_obj.host.git(path)
`@memoized` still doesn't support keyword args yet unfortunately. `@functools.*cache` won't work either because it holds onto `self`, preventing GC.
Perhaps a workaround could be to memoize a helper instead of the method in Host?
E.g. instead of:
```
@memoized
def git(self, path: os.PathLike | None = None) -> Git | None:
git = Git(cwd=path,
executive=self.executive,
filesystem=self.filesystem,
platform=self.platform)
return git if git.checkout_root else None
```
Do:
```
def git(self, path: os.PathLike | None = None) -> Git | None:
return _create_git(cwd=path, executive=self.executive, ...)
...
@functools.cache
def _create_git(*, **kwargs) -> Git | None:
git = Git(**kwargs)
return git if git.checkout_root else None
```
It would be nice to remove the Blink-specific version in favor of `functools.cache` if possible.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Commit-Queue | +1 |
Brian Sheedy`@memoized` still doesn't support keyword args yet unfortunately. `@functools.*cache` won't work either because it holds onto `self`, preventing GC.
Perhaps a workaround could be to memoize a helper instead of the method in Host?
E.g. instead of:
```
@memoized
def git(self, path: os.PathLike | None = None) -> Git | None:
git = Git(cwd=path,
executive=self.executive,
filesystem=self.filesystem,
platform=self.platform)
return git if git.checkout_root else None
```Do:
```
def git(self, path: os.PathLike | None = None) -> Git | None:
return _create_git(cwd=path, executive=self.executive, ...)...
@functools.cache
def _create_git(*, **kwargs) -> Git | None:
git = Git(**kwargs)
return git if git.checkout_root else None
```It would be nice to remove the Blink-specific version in favor of `functools.cache` if possible.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
def _cached_git(**kwargs) -> Git:
Nit: Can also return None.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Auto-Submit | +0 |
Commit-Queue | +2 |
Nit: Can also return None.
Oops, done. One day, I hope to get enough of `blinkpy/` hinted to actually check these and function as more than documentation.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
def _cached_git(**kwargs) -> Git:
Jonathan LeeNit: Can also return None.
Oops, done. One day, I hope to get enough of `blinkpy/` hinted to actually check these and function as more than documentation.
I'm pretty sure the type hinting helpers I set up should allow for skipping certain files, so you could add basically every file under `blinkpy/` to that list and use it as a burndown list for what needs to have type hinting applied.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[blinkpy] Support non-Git checkouts like cogfs
Most callsites can gracefully function without a `git` checkout (e.g.,
`rebaseline-cl` skips staging `*-expected.*`).
Make sure to memoize `Host.git()` so that warnings about an invalid
checkout are only logged once per `path`.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |