@@ -1522,20 +1522,20 @@ def glob(
15221522 self ,
15231523 pattern : str ,
15241524 * ,
1525- case_sensitive : bool = UNSET_DEFAULT ,
1526- recurse_symlinks : bool = UNSET_DEFAULT ,
1525+ case_sensitive : bool | None = None ,
1526+ recurse_symlinks : bool = False ,
15271527 ) -> Iterator [Self ]:
15281528 """Iterate over this subtree and yield all existing files (of any
15291529 kind, including directories) matching the given relative pattern."""
1530- if case_sensitive is not UNSET_DEFAULT :
1530+ if case_sensitive is not None :
15311531 warnings .warn (
15321532 "UPath.glob(): case_sensitive is currently ignored." ,
15331533 UserWarning ,
15341534 stacklevel = 2 ,
15351535 )
1536- if recurse_symlinks is not UNSET_DEFAULT :
1536+ if recurse_symlinks :
15371537 warnings .warn (
1538- "UPath.glob(): recurse_symlinks is currently ignored." ,
1538+ "UPath.glob(): recurse_symlinks=True is currently ignored." ,
15391539 UserWarning ,
15401540 stacklevel = 2 ,
15411541 )
@@ -1552,22 +1552,22 @@ def rglob(
15521552 self ,
15531553 pattern : str ,
15541554 * ,
1555- case_sensitive : bool = UNSET_DEFAULT ,
1556- recurse_symlinks : bool = UNSET_DEFAULT ,
1555+ case_sensitive : bool | None = None ,
1556+ recurse_symlinks : bool = False ,
15571557 ) -> Iterator [Self ]:
15581558 """Recursively yield all existing files (of any kind, including
15591559 directories) matching the given relative pattern, anywhere in
15601560 this subtree.
15611561 """
1562- if case_sensitive is not UNSET_DEFAULT :
1562+ if case_sensitive is not None :
15631563 warnings .warn (
15641564 "UPath.glob(): case_sensitive is currently ignored." ,
15651565 UserWarning ,
15661566 stacklevel = 2 ,
15671567 )
1568- if recurse_symlinks is not UNSET_DEFAULT :
1568+ if recurse_symlinks :
15691569 warnings .warn (
1570- "UPath.glob(): recurse_symlinks is currently ignored." ,
1570+ "UPath.glob(): recurse_symlinks=True is currently ignored." ,
15711571 UserWarning ,
15721572 stacklevel = 2 ,
15731573 )
@@ -1982,11 +1982,37 @@ def is_relative_to(
19821982 def hardlink_to (self , target : ReadablePathLike ) -> None :
19831983 _raise_unsupported (type (self ).__name__ , "hardlink_to" )
19841984
1985- def match (self , pattern : str ) -> bool :
1986- # fixme: hacky emulation of match. needs tests...
1987- if not pattern :
1985+ def full_match (
1986+ self ,
1987+ pattern : str | SupportsPathLike ,
1988+ * ,
1989+ case_sensitive : bool | None = None ,
1990+ ) -> bool :
1991+ """Match this path against the provided glob-style pattern.
1992+ Return True if matching is successful, False otherwise.
1993+ """
1994+ if case_sensitive is not None :
1995+ warnings .warn (
1996+ f"{ type (self ).__name__ } .full_match(): case_sensitive"
1997+ " is currently ignored." ,
1998+ UserWarning ,
1999+ stacklevel = 2 ,
2000+ )
2001+ return super ().full_match (str (pattern ))
2002+
2003+ def match (
2004+ self ,
2005+ path_pattern : str | SupportsPathLike ,
2006+ * ,
2007+ case_sensitive : bool | None = None ,
2008+ ) -> bool :
2009+ """Match this path against the provided non-recursive glob-style pattern.
2010+ Return True if matching is successful, False otherwise.
2011+ """
2012+ path_pattern = str (path_pattern )
2013+ if not path_pattern :
19882014 raise ValueError ("pattern cannot be empty" )
1989- return self .full_match (pattern .replace ("**" , "*" ))
2015+ return self .full_match (path_pattern .replace ("**" , "*" ))
19902016
19912017 @classmethod
19922018 def __get_pydantic_core_schema__ (
0 commit comments