Skip to content

Commit

Permalink
style: add docstring to helper
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-burashnikov committed Nov 6, 2023
1 parent f348eed commit 2dbcde8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions depinspect/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,27 @@ class Archs(Enum):


def is_valid_package_name(package_name: str) -> bool:
"""
Check if a given string is a valid package name.
Parameters:
- package_name (str): The string to be checked.
Returns:
bool: True if the string is a valid package name, False otherwise.
"""
valid_pattern = fullmatch(r"([a-zA-Z0-9][a-zA-Z0-9+-.]{1,})", package_name)
return bool(valid_pattern)


def is_valid_architecture_name(architecture_name: str) -> bool:
"""
Check if a given string is a valid architecture name.
Parameters:
- architecture_name (str): The string to be checked.
Returns:
bool: True if the string is a valid architecture name, False otherwise.
"""
return any(architecture_name == arch.value for arch in Archs)

0 comments on commit 2dbcde8

Please sign in to comment.