Package autopaths

Written by Lucas Sinclair. MIT Licensed. Contact at www.sinclair.bio

Expand source code
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
Written by Lucas Sinclair.
MIT Licensed.
Contact at www.sinclair.bio
"""

# Special variables #
__version__ = '1.6.0'

# Built in modules #
import os

# This is done to avoid circular import errors #
from autopaths import common
from autopaths import file_size
from autopaths import file_permissions
from autopaths import base_path
from autopaths import file_path
from autopaths import dir_path
from autopaths import tmp_path
from autopaths import auto_paths

###############################################################################
def Path(path):
    # Cast to string #
    path = str(path)
    # Return either a file or a directory path #
    if os.path.isdir(path) or path.endswith('/'):
        return dir_path.DirectoryPath(path)
    else:
        return file_path.FilePath(path)

Sub-modules

autopaths.auto_paths

Written by Lucas Sinclair. MIT Licensed. Contact at www.sinclair.bio

autopaths.base_path

Written by Lucas Sinclair. MIT Licensed. Contact at www.sinclair.bio

autopaths.common

Written by Lucas Sinclair. MIT Licensed. Contact at www.sinclair.bio

autopaths.dir_path

Written by Lucas Sinclair. MIT Licensed. Contact at www.sinclair.bio

autopaths.file_path

Written by Lucas Sinclair. MIT Licensed. Contact at www.sinclair.bio

autopaths.file_permissions

Written by Lucas Sinclair. MIT Licensed. Contact at www.sinclair.bio

autopaths.file_size

Written by Lucas Sinclair. MIT Licensed. Contact at www.sinclair.bio

autopaths.tmp_path

Written by Lucas Sinclair. MIT Licensed. Contact at www.sinclair.bio

Functions

def Path(path)
Expand source code
def Path(path):
    # Cast to string #
    path = str(path)
    # Return either a file or a directory path #
    if os.path.isdir(path) or path.endswith('/'):
        return dir_path.DirectoryPath(path)
    else:
        return file_path.FilePath(path)