Skip to content

Commit

Permalink
Make Dependency a TypeAlias
Browse files Browse the repository at this point in the history
The _BaseDependency class is never used except for inheritance.
  • Loading branch information
maresb committed Dec 31, 2022
1 parent faf98dd commit 91fce1f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions conda_lock/src_parser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def for_platform(self, platform: str) -> bool:
return self.platform is None or platform in self.platform


class Dependency(StrictModel):
class _BaseDependency(StrictModel):
name: str
manager: Literal["conda", "pip"] = "conda"
optional: bool = False
Expand All @@ -70,17 +70,20 @@ class Dependency(StrictModel):
selectors: Selectors = Selectors()


class VersionedDependency(Dependency):
class VersionedDependency(_BaseDependency):
version: str
build: Optional[str] = None
conda_channel: Optional[str] = None


class URLDependency(Dependency):
class URLDependency(_BaseDependency):
url: str
hashes: List[str]


Dependency = Union[VersionedDependency, URLDependency]


class Package(StrictModel):
url: str
hash: str
Expand Down

0 comments on commit 91fce1f

Please sign in to comment.