""" **Description**
Path interface.
**Example**
::
from diamondback import IPath
class Test( IPath ) :
def __init__( self ) -> None :
super( ).__init__( )
self.path = ''
test = Test( )
test.path = '.\data'
**License**
`BSD-3C. <https://github.com/larryturner/diamondback/blob/master/license>`_
© 2018 - 2021 Larry Turner, Schneider Electric Industries SAS. All rights reserved.
**Author**
Larry Turner, Schneider Electric, Analytics & AI, 2020-01-09.
**Definition**
"""
from diamondback.interfaces.IEqual import IEqual
from typing import Any
import os
[docs]class IPath( IEqual ) :
""" Path interface.
"""
@property
def path( self ) :
""" path : str.
"""
return self._path
@path.setter
def path( self, path : str ) :
if ( path ) :
path = path.replace( '/', os.path.sep ).replace( '\\', os.path.sep )
if ( not os.path.exists( path ) ) :
raise FileNotFoundError( f'Path = {path}' )
self._path = path
[docs] def __eq__( self, other : Any ) -> bool :
""" Equal.
Arguments :
other : Any.
Returns :
equal : bool.
"""
return ( ( super( ).__eq__( other ) ) and ( self.path == other.path ) )
def __init__( self ) -> None :
""" Initialize.
"""
super( ).__init__( )
self._path = None