# 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": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "DataSet,File-Search,File-Controle",
"author": "Tamon Mikawa",
"author_email": "mtamon.engineering@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/fa/b7/d23114310d2e36766eaee4e92e7e3e3f0c9d10fff741906683126bd237f6/dfcon-0.2.4.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.4",
"project_urls": {
"Homepage": "https://github.com/MTamon/dataFileController.git"
},
"split_keywords": [
"dataset",
"file-search",
"file-controle"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "097fa820d55b8e0c09b71a2d3339568ae96cf97a6f686987d5195e69120edfcc",
"md5": "0cb3b52ef172af63c45a2e14641545ed",
"sha256": "062d9b5fb4d130f6e974d130735f8ff503d7d18530c002103478fcf753381f06"
},
"downloads": -1,
"filename": "dfcon-0.2.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0cb3b52ef172af63c45a2e14641545ed",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7138,
"upload_time": "2023-12-26T15:22:09",
"upload_time_iso_8601": "2023-12-26T15:22:09.635160Z",
"url": "https://files.pythonhosted.org/packages/09/7f/a820d55b8e0c09b71a2d3339568ae96cf97a6f686987d5195e69120edfcc/dfcon-0.2.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fab7d23114310d2e36766eaee4e92e7e3e3f0c9d10fff741906683126bd237f6",
"md5": "f906f2e3fb92e21a15912a7943dee023",
"sha256": "cb36d74cb96dd4416f2f3c7d5e78f1ee371e41203817babcf2473e2be31ba55a"
},
"downloads": -1,
"filename": "dfcon-0.2.4.tar.gz",
"has_sig": false,
"md5_digest": "f906f2e3fb92e21a15912a7943dee023",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9364,
"upload_time": "2023-12-26T15:22:11",
"upload_time_iso_8601": "2023-12-26T15:22:11.769418Z",
"url": "https://files.pythonhosted.org/packages/fa/b7/d23114310d2e36766eaee4e92e7e3e3f0c9d10fff741906683126bd237f6/dfcon-0.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-26 15:22:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MTamon",
"github_project": "dataFileController",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "dfcon"
}