| |
- builtins.object
-
- FileInfoManager
- builtins.tuple(builtins.object)
-
- vcorelib.paths.info.FileInfo
- FileChanged
- enum.Enum(builtins.object)
-
- vcorelib.paths.info.FileChangeEvent
class FileChangeEvent(enum.Enum) |
|
FileChangeEvent(*values)
An enumeration describing possible file-change events. |
|
- Method resolution order:
- FileChangeEvent
- enum.Enum
- builtins.object
Data and other attributes defined here:
- CREATED = <FileChangeEvent.CREATED: 1>
- REMOVED = <FileChangeEvent.REMOVED: 2>
- UPDATED = <FileChangeEvent.UPDATED: 3>
Data descriptors inherited from enum.Enum:
- name
- The name of the Enum member.
- value
- The value of the Enum member.
Methods inherited from enum.EnumType:
- __contains__(value) from enum.EnumType
- Return True if `value` is in `cls`.
`value` is in `cls` if:
1) `value` is a member of `cls`, or
2) `value` is the value of one of the `cls`'s members.
- __getitem__(name) from enum.EnumType
- Return the member matching `name`.
- __iter__() from enum.EnumType
- Return members in definition order.
- __len__() from enum.EnumType
- Return the number of members (no aliases)
Readonly properties inherited from enum.EnumType:
- __members__
- Returns a mapping of member name->value.
This mapping lists all enum members, including aliases. Note that this
is a read-only view of the internal mapping.
|
class FileChanged(builtins.tuple) |
|
FileChanged(new: Optional[vcorelib.paths.info.FileInfo], old: Optional[vcorelib.paths.info.FileInfo], event: vcorelib.paths.info.FileChangeEvent)
Data provided to a file-changed callback. |
|
- Method resolution order:
- FileChanged
- builtins.tuple
- builtins.object
Methods defined here:
- __getnewargs__(self)
- Return self as a plain tuple. Used by copy and pickle.
- __repr__(self)
- Return a nicely formatted representation string
- _asdict(self)
- Return a new dict which maps field names to their values.
- _replace(self, /, **kwds)
- Return a new FileChanged object replacing specified fields with new values
Class methods defined here:
- _make(iterable) from builtins.type
- Make a new FileChanged object from a sequence or iterable
Static methods defined here:
- __new__(_cls, new: Optional[vcorelib.paths.info.FileInfo], old: Optional[vcorelib.paths.info.FileInfo], event: vcorelib.paths.info.FileChangeEvent)
- Create new instance of FileChanged(new, old, event)
Data descriptors defined here:
- new
- Alias for field number 0
- old
- Alias for field number 1
- event
- Alias for field number 2
Data and other attributes defined here:
- __annotations__ = {'event': <enum 'FileChangeEvent'>, 'new': typing.Optional[vcorelib.paths.info.FileInfo], 'old': typing.Optional[vcorelib.paths.info.FileInfo]}
- __match_args__ = ('new', 'old', 'event')
- __orig_bases__ = (<function NamedTuple>,)
- _field_defaults = {}
- _fields = ('new', 'old', 'event')
Methods inherited from builtins.tuple:
- __add__(self, value, /)
- Return self+value.
- __contains__(self, key, /)
- Return bool(key in self).
- __eq__(self, value, /)
- Return self==value.
- __ge__(self, value, /)
- Return self>=value.
- __getattribute__(self, name, /)
- Return getattr(self, name).
- __getitem__(self, key, /)
- Return self[key].
- __gt__(self, value, /)
- Return self>value.
- __hash__(self, /)
- Return hash(self).
- __iter__(self, /)
- Implement iter(self).
- __le__(self, value, /)
- Return self<=value.
- __len__(self, /)
- Return len(self).
- __lt__(self, value, /)
- Return self<value.
- __mul__(self, value, /)
- Return self*value.
- __ne__(self, value, /)
- Return self!=value.
- __rmul__(self, value, /)
- Return value*self.
- count(self, value, /)
- Return number of occurrences of value.
- index(self, value, start=0, stop=9223372036854775807, /)
- Return first index of value.
Raises ValueError if the value is not present.
Class methods inherited from builtins.tuple:
- __class_getitem__(...) from builtins.type
- See PEP 585
|
class FileInfo(builtins.tuple) |
|
FileInfo(path: pathlib.Path, size: int, md5_hex: str, modified_ns: int)
A collection of data to describe an identity of a file. |
|
- Method resolution order:
- FileInfo
- builtins.tuple
- builtins.object
Methods defined here:
- __eq__(self, other: object) -> bool
- Determine if two file info's are equivalent.
- __getnewargs__(self)
- Return self as a plain tuple. Used by copy and pickle.
- __hash__(self) -> int
- Get a hash for this file info based on the file name.
- __repr__(self)
- Return a nicely formatted representation string
- _asdict(self)
- Return a new dict which maps field names to their values.
- _replace(self, /, **kwds)
- Return a new FileInfo object replacing specified fields with new values
- poll(self, check_contents: bool = True) -> Tuple[Optional[vcorelib.paths.info.FileChangeEvent], Optional[ForwardRef('FileInfo')]]
- Determine if this file is in a new state or not.
- same(self, other: 'FileInfo') -> bool
- Check if two file info contents match.
- to_json(self, data: Dict[str, Union[str, int, float, bool, NoneType, Dict[str, Union[str, int, float, bool, NoneType]], List[Union[str, int, float, bool, NoneType]]]] = None) -> Dict[str, Union[str, int, float, bool, NoneType, Dict[str, Union[str, int, float, bool, NoneType]], List[Union[str, int, float, bool, NoneType]]]]
- Get JSON data for this instance.
Class methods defined here:
- _make(iterable) from builtins.type
- Make a new FileInfo object from a sequence or iterable
Static methods defined here:
- __new__(_cls, path: pathlib.Path, size: int, md5_hex: str, modified_ns: int)
- Create new instance of FileInfo(path, size, md5_hex, modified_ns)
- from_file(path: Union[pathlib.Path, str, NoneType], stats: os.stat_result = None) -> 'FileInfo'
- Create file info from a file.
- from_json(data: Dict[str, Union[str, int, float, bool, NoneType, Dict[str, Union[str, int, float, bool, NoneType]], List[Union[str, int, float, bool, NoneType]]]], force: bool = False) -> Dict[pathlib.Path, ForwardRef('FileInfo')]
- Create file info from JSON data.
Data descriptors defined here:
- path
- Alias for field number 0
- size
- Alias for field number 1
- md5_hex
- Alias for field number 2
- modified_ns
- Alias for field number 3
Data and other attributes defined here:
- __annotations__ = {'md5_hex': <class 'str'>, 'modified_ns': <class 'int'>, 'path': <class 'pathlib.Path'>, 'size': <class 'int'>}
- __match_args__ = ('path', 'size', 'md5_hex', 'modified_ns')
- __orig_bases__ = (<function NamedTuple>,)
- _field_defaults = {}
- _fields = ('path', 'size', 'md5_hex', 'modified_ns')
Methods inherited from builtins.tuple:
- __add__(self, value, /)
- Return self+value.
- __contains__(self, key, /)
- Return bool(key in self).
- __ge__(self, value, /)
- Return self>=value.
- __getattribute__(self, name, /)
- Return getattr(self, name).
- __getitem__(self, key, /)
- Return self[key].
- __gt__(self, value, /)
- Return self>value.
- __iter__(self, /)
- Implement iter(self).
- __le__(self, value, /)
- Return self<=value.
- __len__(self, /)
- Return len(self).
- __lt__(self, value, /)
- Return self<value.
- __mul__(self, value, /)
- Return self*value.
- __ne__(self, value, /)
- Return self!=value.
- __rmul__(self, value, /)
- Return value*self.
- count(self, value, /)
- Return number of occurrences of value.
- index(self, value, start=0, stop=9223372036854775807, /)
- Return first index of value.
Raises ValueError if the value is not present.
Class methods inherited from builtins.tuple:
- __class_getitem__(...) from builtins.type
- See PEP 585
|
class FileInfoManager(builtins.object) |
|
FileInfoManager(poll_cb: Callable[[vcorelib.paths.info_cache.FileChanged], bool], initial: Dict[pathlib.Path, vcorelib.paths.info.FileInfo] = None, logger: Union[logging.Logger, logging.LoggerAdapter[Any]] = None, level: int = 10, check_contents: bool = True) -> None
A class simplifying evaluation of changes to files on disk. |
|
Methods defined here:
- __init__(self, poll_cb: Callable[[vcorelib.paths.info_cache.FileChanged], bool], initial: Dict[pathlib.Path, vcorelib.paths.info.FileInfo] = None, logger: Union[logging.Logger, logging.LoggerAdapter[Any]] = None, level: int = 10, check_contents: bool = True) -> None
- Initialize this file-info manager.
- poll_directory(self, path: Union[pathlib.Path, str, NoneType], recurse: bool = True, base: Union[pathlib.Path, str, NoneType] = None) -> None
- Poll an entire directory for changes. If files previously in this
directory were polled and are no longer present, they won't be polled
and thus won't trigger the callback. Use 'poll_existing' for that
behavior.
- poll_existing(self, base: Union[pathlib.Path, str, NoneType] = None) -> None
- Poll all existing files. This is the only way to detect files that have
been deleted.
- poll_file(self, path: Union[pathlib.Path, str, NoneType], base: Union[pathlib.Path, str, NoneType] = None) -> None
- Check if a file has changed and invoke the callback if so.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
| |