PyFunctional 项目教程
1. 项目的目录结构及介绍
PyFunctional 项目的目录结构如下:
PyFunctional/
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── MANIFEST.in
├── README.md
├── docs/
│ ├── Makefile
│ ├── api.rst
│ ├── conf.py
│ ├── developer.rst
│ ├── index.rst
│ ├── make.bat
│ ├── streams.rst
│ ├── transformations.rst
│ └── util.rst
├── pyfunctional/
│ ├── __init__.py
│ ├── functional.py
│ ├── lineage.py
│ ├── pipeline.py
│ ├── streams.py
│ ├── transformations.py
│ └── util.py
├── requirements.txt
├── setup.cfg
├── setup.py
└── tests/
├── __init__.py
├── test_functional.py
├── test_lineage.py
├── test_pipeline.py
├── test_streams.py
├── test_transformations.py
└── test_util.py
目录结构介绍
CHANGELOG.md
: 记录项目版本变更历史。CONTRIBUTING.md
: 贡献指南,指导开发者如何为项目贡献代码。LICENSE
: 项目许可证文件。MANIFEST.in
: 用于打包时的文件列表。README.md
: 项目介绍和使用说明。docs/
: 项目文档目录,包含 Sphinx 文档配置和源文件。pyfunctional/
: 项目源代码目录,包含核心功能实现。requirements.txt
: 项目依赖列表。setup.cfg
: 项目构建配置文件。setup.py
: 项目安装脚本。tests/
: 项目测试代码目录,包含单元测试文件。
2. 项目的启动文件介绍
PyFunctional 项目的启动文件是 pyfunctional/__init__.py
。这个文件是项目的入口点,负责初始化模块并导出主要功能。
__init__.py
文件内容
from .functional import seq
from .streams import *
from .transformations import *
from .util import *
__all__ = [
'seq',
'read_stream',
'read_text',
'read_csv',
'read_json',
'read_pickle',
'read_lines',
'read_source',
'select',
'map',
'starmap',
'flat_map',
'filter',
'filter_not',
'reduce',
'group_by',
'group_by_key',
'count',
'count_by_key',
'distinct',
'union',
'intersection',
'difference',
'symmetric_difference',
'zip',
'zip_with_index',
'sorted',
'reverse',
'random_sample',
'cache',
'to_list',
'to_dict',
'to_file',
'to_csv',
'to_json',
'to_pickle',
'to_string',
'sum',
'max',
'min',
'mean',
'median',
'stdev',
'variance',
'join',
'partition',
'slice',
'take',
'drop',
'take_while',
'drop_while',
'exists',
'for_each',
'make_string',
'size',
'is_empty',
'non_empty',
'get_column',
'set_column',
'add_column',
'drop_column',
'rename_column',
'explode',
'aggregate',
'aggregate_by_key',
'parallelize',
'lineage',
'util'
]
启动文件介绍
seq
: 创建一个序列对象,用于链式操作。read_stream
,read_text
,read_csv
,read_json
,read_pickle
,read_lines
,read_source
: 读