Skip to content

Commit

Permalink
_bind_flavours added auto option to create the win and posix
Browse files Browse the repository at this point in the history
subclasses automatically using type()
  • Loading branch information
tgbugs committed Oct 16, 2019
1 parent 4bc6d3c commit 26dcea9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion augpathlib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,11 @@ class AugmentedPath(pathlib.Path):


@classmethod
def _bind_flavours(cls):
def _bind_flavours(cls, auto=False):
if auto:
win = type('{cls.__name__}{Windows}', (cls, pathlib.WindowsPath), {})
pos = type('{cls.__name__}{Posix}', (cls, pathlib.PosixPath), {})

cls.__abstractpath = cls
for subcls in cls.__subclasses__(): # direct only
if subcls._flavour is pathlib._posix_flavour:
Expand Down

0 comments on commit 26dcea9

Please sign in to comment.