import fnmatch def matches_one_glob_condition(item: str, conditions: list[str]) -> bool: """ Check if the given item matches at least one of the specified glob patterns. Args: item (str): The item to check. conditions (list[str]): A list of glob patterns to match against the item. Returns: bool: True if the item matches at least one condition, False otherwise. """ for condition in conditions: if fnmatch.fnmatch(item, condition): return True return False print(matches_one_glob_condition('beir/scifacts/test', ['beir/*/test']))
Monday, 25 March 2024
Python: Check if a string matches at least one glob condition
Subscribe to:
Post Comments (Atom)
Parse Wikipedia dump
""" This module processes Wikipedia dump files by extracting individual articles and parsing them into a structured format, ...
-
Der Kollektivgeist: Ihr intelligentes Unternehmensgedächtnis Wissen aus den Köpfen der Mitarbeiter extrahieren - Die ...
-
docker pull quay.io/unstructured-io/unstructured-api 20gb image. After docker-pull: docker image inspect --format '{{json .}}' ...
No comments:
Post a Comment