# 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/65/a1/e1928195bfe755effd3b80cdf9c65bd857de26bd7b6145e02de909426101/dfcon-0.2.10.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.10",
"project_urls": {
"Homepage": "https://github.com/MTamon/dataFileController.git"
},
"split_keywords": [
"dataset",
" file-search",
" file-controle"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "ef14d46ba03db7727ada58615689d7ef2c0af2e7a4e999b06f00d1fa40a4b041",
"md5": "d298ef8cc3252121906acefeb671bc2a",
"sha256": "e82b1fc3367c351b0973484f0f582a279369c20601dd0d3764d5e55e4faed745"
},
"downloads": -1,
"filename": "dfcon-0.2.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d298ef8cc3252121906acefeb671bc2a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7271,
"upload_time": "2025-08-29T13:31:44",
"upload_time_iso_8601": "2025-08-29T13:31:44.331687Z",
"url": "https://files.pythonhosted.org/packages/ef/14/d46ba03db7727ada58615689d7ef2c0af2e7a4e999b06f00d1fa40a4b041/dfcon-0.2.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "65a1e1928195bfe755effd3b80cdf9c65bd857de26bd7b6145e02de909426101",
"md5": "fd7aae25a3b8baa9fe1552a8026bcfdf",
"sha256": "4a0ae5f9b0eb7be7d64fe8ffc0a5dd7995227dedaee8e091418366052a625fb6"
},
"downloads": -1,
"filename": "dfcon-0.2.10.tar.gz",
"has_sig": false,
"md5_digest": "fd7aae25a3b8baa9fe1552a8026bcfdf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9650,
"upload_time": "2025-08-29T13:31:45",
"upload_time_iso_8601": "2025-08-29T13:31:45.455576Z",
"url": "https://files.pythonhosted.org/packages/65/a1/e1928195bfe755effd3b80cdf9c65bd857de26bd7b6145e02de909426101/dfcon-0.2.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-29 13:31:45",
"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"
}