Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dfcon-0.2.12.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dfcon-0.2.12-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file dfcon-0.2.12.tar.gz.

File metadata

  • Download URL: dfcon-0.2.12.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.9

File hashes

Hashes for dfcon-0.2.12.tar.gz
Algorithm Hash digest
SHA256 0dfae6d66fa3381584331da8d9c30dcc3e5b2af32b3054009214e092c36c11d4
MD5 2049d41a401dd5f2cdd1aaa88a07136e
BLAKE2b-256 d942e05fa71d9a9c52f3132cc241bd78de4d760d1c806e651655d8a1f377d1cd

See more details on using hashes here.

File details

Details for the file dfcon-0.2.12-py3-none-any.whl.

File metadata

  • Download URL: dfcon-0.2.12-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.9

File hashes

Hashes for dfcon-0.2.12-py3-none-any.whl
Algorithm Hash digest
SHA256 fde644f5f0d5f281a6e8678383929c7542c018c6b4165f0bb871f1619650be76
MD5 60cdb0de9e78023bfa343335b0b3b3c3
BLAKE2b-256 363ec838a5b4d7ce409b16261015a76eda74634f272b93ee45a5238914e0e6ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page