# dfcon : dataFileController
To make access to the database easier.
## Installation
```Bash
pip install dfcon
```
## Requirements
- Python 3.x
## Usage
### module import ( and bref description )
```python
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.
```python
filter1 = MyFilter()
filter2 = MyFilter()
...
filters: OverlapedFilter = Filter.overlap([filter1, filter2, ...])
```
other method,
```python
filters = filter1 & filter2
```
#### TiledFilter
`TiledFilter` is compound filter consisting of a Filter joined by the OR operator.\
This is `Filter`'s subclass.
```python
filters: TiledFilter = Filter.tile([filter1, filter2, ...])
```
other method,
```python
filters = filter1 | filter2
```
#### DircFilter
`DircFilter` makes a judgment about the directory of the file path.\
This is `Filter`'s subclass.
```python
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.
```python
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
```python
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`.
```python
path = "path/to/target"
dirc = Directory(path)
file_gen = dirc.get_file_path()
```
You can apply `filters`, such as `FileFilter` and `DircFilter`.
Raw data
{
"_id": null,
"home_page": "https://github.com/MTamon/dataFileController.git",
"name": "dfcon",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "DataSet, File-Search, File-Controle",
"author": "Tamon Mikawa",
"author_email": "mtamon.engineering@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/4e/e8/2cdc7838cac2a2b6df709e5c7a253dcd2a9ab50d028edc4a1733d52a2dfa/dfcon-0.2.7.tar.gz",
"platform": null,
"description": "# dfcon : dataFileController\nTo make access to the database easier.\n\n## Installation\n```Bash\npip install dfcon\n```\n\n## Requirements\n- Python 3.x\n\n## Usage\n### module import ( and bref description )\n```python\nfrom dfcon import Directory\nfrom dfcon.path_filter import DircFilter, FileFilter\nfrom cmpfilter import Filter, TiledFilter, OverlapedFilter\n```\n\n### Filter\n#### Filter\n`Filter` is the callable class that extends Python's conditional expressions.\\\nThis can determine if an object meets the condition.\\\n`Filter` is abstruct class, the programmer can create filter classes for any object or data.\n\n#### OverlapedFilter\n`OverlapedFilter` is compound filter consisting of a Filter joined by the AND operator.\\\nThis is `Filter`'s subclass.\n```python\nfilter1 = MyFilter()\nfilter2 = MyFilter()\n...\n\nfilters: OverlapedFilter = Filter.overlap([filter1, filter2, ...])\n```\nother method,\n```python\nfilters = filter1 & filter2\n```\n\n#### TiledFilter\n`TiledFilter` is compound filter consisting of a Filter joined by the OR operator.\\\nThis is `Filter`'s subclass.\n```python\nfilters: TiledFilter = Filter.tile([filter1, filter2, ...])\n```\nother method,\n```python\nfilters = filter1 | filter2\n```\n\n#### DircFilter\n`DircFilter` makes a judgment about the directory of the file path.\\\nThis is `Filter`'s subclass.\n```python\ndfilter = DircFilter().contained_path(\"abc\")\n\nif dfilter(\"./src/sample.py\"): # False\n ...\nif dfilter(\"./abc/sample.py\"): # True\n ...\n```\n`DircFilter` class used in `Directory` and its some function's arguments.\n\n#### FileFilter\n`FileFilter` makes a judgment about the filename of the file path.\\\nThis is `Filter`'s subclass.\n```python\nffilter = (\n FileFilter()\n .include_extention([\"py\", \"txt\"])\n .exclude_extention([\"c\", \"cpp\"])\n)\n\nif ffilter(\"./src/sample.py\"): # True\n ...\nif ffilter(\"./abc/sample.txt\"): # True\n ...\nif ffilter(\"./abc/sample.c\"): # False\n ...\nif ffilter(\"./abc/sample.cpp\"): # False\n ...\n```\n`FileFilter` class used in `Directory` and its some function's arguments.\n\n### Directory\n#### Directory\n`Directory` instance can be made by\n```python\ndirc = Directory(path=\"path/to/target\")\n```\n#### get_file_path(filters)\n`filters`, default to `None`. \\\nType of `filters` is `Filter | List[Filter] | None` \\\nThis function return generator of file list which belongs to `path`. \n```python\npath = \"path/to/target\"\ndirc = Directory(path)\nfile_gen = dirc.get_file_path()\n```\nYou can apply `filters`, such as `FileFilter` and `DircFilter`. \n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "To make access to the database easier.",
"version": "0.2.7",
"project_urls": {
"Homepage": "https://github.com/MTamon/dataFileController.git"
},
"split_keywords": [
"dataset",
" file-search",
" file-controle"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e342ba4b91d1f1b3385e224e93b4e2c067c26ca150b649ec8c7206d5e772d67f",
"md5": "3998da178c880571b4bbe9a2786cf150",
"sha256": "29cfd774328e96bd5fa2bbf7084c18693ba0d17763c860313f33e2e57c25a65b"
},
"downloads": -1,
"filename": "dfcon-0.2.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3998da178c880571b4bbe9a2786cf150",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7119,
"upload_time": "2024-11-01T19:12:06",
"upload_time_iso_8601": "2024-11-01T19:12:06.789798Z",
"url": "https://files.pythonhosted.org/packages/e3/42/ba4b91d1f1b3385e224e93b4e2c067c26ca150b649ec8c7206d5e772d67f/dfcon-0.2.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4ee82cdc7838cac2a2b6df709e5c7a253dcd2a9ab50d028edc4a1733d52a2dfa",
"md5": "0fd400730dd6462a2ddbb3ceead62e70",
"sha256": "ed3bc094f5af9dc1b6f2892fb916e8ad1158bf260629bc0fed59e928c85ba855"
},
"downloads": -1,
"filename": "dfcon-0.2.7.tar.gz",
"has_sig": false,
"md5_digest": "0fd400730dd6462a2ddbb3ceead62e70",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9397,
"upload_time": "2024-11-01T19:12:08",
"upload_time_iso_8601": "2024-11-01T19:12:08.512233Z",
"url": "https://files.pythonhosted.org/packages/4e/e8/2cdc7838cac2a2b6df709e5c7a253dcd2a9ab50d028edc4a1733d52a2dfa/dfcon-0.2.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-01 19:12:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MTamon",
"github_project": "dataFileController",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "tqdm",
"specs": [
[
"==",
"4.64.1"
]
]
},
{
"name": "cmpfilter",
"specs": []
}
],
"lcname": "dfcon"
}