astro.files.locations.base

Module Contents

Classes

BaseFileLocation

Base Location abstract class

class astro.files.locations.base.BaseFileLocation(path, conn_id=None)

Bases: abc.ABC

Base Location abstract class

Parameters
  • path (str) –

  • conn_id (str | None) –

template_fields = ['path', 'conn_id']
property hook
property location_type

Property to identify location type

property paths

Resolve patterns in path

Return type

list[str]

property transport_params

Get credentials required by smart open to access files

Return type

dict | None

property size

Return the size in bytes of the given file

static is_valid_path(path)

Check if the given path is either a valid URI or a local file

Parameters

path (str) – Either local filesystem path or remote URI

Return type

bool

static check_non_existing_local_file_path(path)

Check if the path is valid by creating and temp file and then deleting it. Assumes the file don’t exist

Parameters

path (str) –

Return type

bool

static get_location_type(path)

Identify where a file is located

Parameters

path (str) – Path to a file in the filesystem/Object stores

Return type

astro.constants.FileLocation

exists()

Check if the file exists or not

Return type

bool