Skip to content
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

Improve typing information in remove sub API #17564

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions conan/api/subapi/remove.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Optional

from conan.api.model import Remote
from conan.internal.conan_app import ConanBasicApp
from conans.model.package_ref import PkgReference
Expand All @@ -9,7 +11,7 @@ class RemoveAPI:
def __init__(self, conan_api):
self.conan_api = conan_api

def recipe(self, ref: RecipeReference, remote: Remote=None):
def recipe(self, ref: RecipeReference, remote: Optional[Remote] = None):
assert ref.revision, "Recipe revision cannot be None to remove a recipe"
"""Removes the recipe (or recipe revision if present) and all the packages (with all prev)"""
app = ConanBasicApp(self.conan_api)
Expand All @@ -20,7 +22,7 @@ def recipe(self, ref: RecipeReference, remote: Remote=None):
recipe_layout = app.cache.recipe_layout(ref)
app.cache.remove_recipe_layout(recipe_layout)

def all_recipe_packages(self, ref: RecipeReference, remote: Remote = None):
def all_recipe_packages(self, ref: RecipeReference, remote: Optional[Remote] = None):
assert ref.revision, "Recipe revision cannot be None to remove a recipe"
"""Removes all the packages from the provided reference"""
app = ConanBasicApp(self.conan_api)
Expand All @@ -38,7 +40,7 @@ def _remove_all_local_packages(app, ref):
package_layout = app.cache.pkg_layout(pref)
app.cache.remove_package_layout(package_layout)

def package(self, pref: PkgReference, remote: Remote):
def package(self, pref: PkgReference, remote: Optional[Remote]):
assert pref.ref.revision, "Recipe revision cannot be None to remove a package"
assert pref.revision, "Package revision cannot be None to remove a package"

Expand Down
Loading