To make access to the database easier.
Project description
dfcon : dataFileController
To make access to the database easier.
Installation
pip install dfcon
Requirements
- Python 3.x
Usage
module import ( and bref description )
from dfcon import Directory
from dfcon.path_filter import DircFilter, FileFilter
from cmpfilter import Filter, TiledFilter, OverlapedFilter
Filter
Filter
Filter
is the callable class that extends Python's conditional expressions.
This can determine if an object meets the condition.
Filter
is abstruct class, the programmer can create filter classes for any object or data.
OverlapedFilter
OverlapedFilter
is compound filter consisting of a Filter joined by the AND operator.
This is Filter
's subclass.
filter1 = MyFilter()
filter2 = MyFilter()
...
filters: OverlapedFilter = Filter.overlap([filter1, filter2, ...])
other method,
filters = filter1 & filter2
TiledFilter
TiledFilter
is compound filter consisting of a Filter joined by the OR operator.
This is Filter
's subclass.
filters: TiledFilter = Filter.tile([filter1, filter2, ...])
other method,
filters = filter1 | filter2
DircFilter
DircFilter
makes a judgment about the directory of the file path.
This is Filter
's subclass.
dfilter = DircFilter().contained_path("abc")
if dfilter("./src/sample.py"): # False
...
if dfilter("./abc/sample.py"): # True
...
DircFilter
class used in Directory
and its some function's arguments.
FileFilter
FileFilter
makes a judgment about the filename of the file path.
This is Filter
's subclass.
ffilter = (
FileFilter()
.include_extention(["py", "txt"])
.exclude_extention(["c", "cpp"])
)
if ffilter("./src/sample.py"): # True
...
if ffilter("./abc/sample.txt"): # True
...
if ffilter("./abc/sample.c"): # False
...
if ffilter("./abc/sample.cpp"): # False
...
FileFilter
class used in Directory
and its some function's arguments.
Directory
Directory
Directory
instance can be made by
dirc = Directory(path="path/to/target")
get_file_path(filters)
filters
, default to None
.
Type of filters
is Filter | List[Filter] | None
This function return generator of file list which belongs to path
.
path = "path/to/target"
dirc = Directory(path)
file_gen = dirc.get_file_path()
You can apply filters
, such as FileFilter
and DircFilter
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dfcon-0.2.6.tar.gz
.
File metadata
- Download URL: dfcon-0.2.6.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.3rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8b93397f9564ccd941cacc6e8ab9832d9dbeefe109caf4b0e83ffc934085f48 |
|
MD5 | 16be49dd56d5a3cdbb6f0636331fd7b8 |
|
BLAKE2b-256 | da722d3000c672563c45088a240acfb8f3b4f0ff645d965b53a6c2dc895d1f10 |
File details
Details for the file dfcon-0.2.6-py3-none-any.whl
.
File metadata
- Download URL: dfcon-0.2.6-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.3rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0504ff69fba6730a5a7f0c8901272981e096b09ae6404f3ce40df5b836d621c2 |
|
MD5 | 7be7b85a6cc2532276ea3aa9cf7ea76a |
|
BLAKE2b-256 | 25e6916f138bd8a399b4310a57309cb6d7ab809f00d039316bec0ffbb1e00b39 |