Skip to content

Commit

Permalink
Merge pull request #209 from chinapnr/v1.1.6_develop
Browse files Browse the repository at this point in the history
V1.1.6 develop
  • Loading branch information
itaa committed Jan 29, 2019
2 parents d36b69d + 5ba3a81 commit 9f8a16e
Show file tree
Hide file tree
Showing 23 changed files with 994 additions and 828 deletions.
125 changes: 60 additions & 65 deletions README.rst
Expand Up @@ -9,40 +9,36 @@
:target: https://ci.appveyor.com/project/itaa/fishbase


fishbase 是什么?
fishbase 简介
=================

fishbase 是由我们自主开发、整理的一套 Python 基础函数库。

从多年的 Python 开发经验中,我们抽象出了很多通用的方法,为日常的开发工作带来极大的便利。

fishbase 设计的初衷,并不是用来解决复杂问题,而是对系统函数进一步封装,从而减少程序开发工作量、降低引用复杂度。

目前,我们正在加速 fishbase 的完善,涵盖单元测试、示例代码、文档等内容优化。希望借此帮助到更多 Python 爱好者和应用开发人员。


模块
========

目前主要分为以下模块:

- fish_common 基本函数包

- fish_csv csv 处理增强函数包

- fish_data 数据信息处理函数包,含银行卡、身份证等

- fish_date 日期处理函数包

- fish_file 文件处理增强函数包

- fish_logger 日志记录增强函数包

- fish_project project 目录结构生成函数包

- fish_random 随机数据生成函数包

- fish_system 系统增强函数包
fishbase 是由我们自主开发和整理的一套 Python 基础函数库。

自 2016/3 初次发布以来,我们坚持不断更新,先后发布了 20 余个版本。近一年来,我们逐步形成每月更新 1 到 2 个版本的频率,抽象出了很多通用的方法,主要分为以下模块:

+----------------------------------------------------------------------------------+----------------------------------------+
| 模块 | 功能函数 |
+==================================================================================+========================================+
| `fish_common <https://fishbase.readthedocs.io/en/latest/fish_common.html>`_ | 基本函数包 |
+----------------------------------------------------------------------------------+----------------------------------------+
| `fish_crypt <https://fishbase.readthedocs.io/en/latest/fish_crypt.html>`_ | 加密数据函数包 |
+----------------------------------------------------------------------------------+----------------------------------------+
| `fish_csv <https://fishbase.readthedocs.io/en/latest/fish_csv.html>`_ | csv 处理增强函数包 |
+----------------------------------------------------------------------------------+----------------------------------------+
| `fish_data <https://fishbase.readthedocs.io/en/latest/fish_data.html>`_ | 数据信息处理函数包,含银行卡、身份证等 |
+----------------------------------------------------------------------------------+----------------------------------------+
| `fish_date <https://fishbase.readthedocs.io/en/latest/fish_date.html>`_ | 日期处理增强函数包 |
+----------------------------------------------------------------------------------+----------------------------------------+
| `fish_file <https://fishbase.readthedocs.io/en/latest/fish_file.html>`_ | 文件处理增强函数包 |
+----------------------------------------------------------------------------------+----------------------------------------+
| `fish_logger <https://fishbase.readthedocs.io/en/latest/fish_logger.html>`_ | 日志记录增强函数包 |
+----------------------------------------------------------------------------------+----------------------------------------+
| `fish_project <https://fishbase.readthedocs.io/en/latest/fish_project.html>`_ | project 目录结构生成函数包 |
+----------------------------------------------------------------------------------+----------------------------------------+
| `fish_random <https://fishbase.readthedocs.io/en/latest/fish_random.html>`_ | 随机数据生成函数包 |
+----------------------------------------------------------------------------------+----------------------------------------+
| `fish_system <https://fishbase.readthedocs.io/en/latest/fish_system.html>`_ | 系统增强函数包 |
+----------------------------------------------------------------------------------+----------------------------------------+



Expand All @@ -59,39 +55,49 @@ fishbase 能干什么?
===================


生成手机号
----------
获取当前系统类型
--------------

.. code:: python
>>> from fishbase.fish_random import gen_mobile
>>> # 随机生成一个手机号
>>> print(gen_mobile())
188****3925
>>> from fishbase.fish_system import get_platform
>>> print('current os:', get_platform())
current os: osx
取名字
------
获取文件的绝对路径
----------------

.. code:: python
>>> from fishbase.fish_random import gen_name
>>> # 随机生成一个姓名
>>> print(gen_name())
*
>>> # 随机生成一个姓名,姓赵/男孩/3个字
>>> gen_name("","01", 3)
**
>>> from fishbase.fish_common import find_files
>>> print(get_abs_filename_with_sub_path('/etc', 'hosts'))
(True, '/etc/hosts')
找文件
------
根据时间戳获取时间间隔
--------------------

.. code:: python
>>> from fishbase.fish_common import find_files
>>> # 获取当前路径下的 mp4 文件
>>> print(find_files(".", [".mp4"]))
>>> from fishbase.fish_date import get_time_interval
>>> print(get_time_interval(1548575829,1548476921))
{'days': 1, 'hours': 3, 'minutes': 28, 'seconds': 28}
生成随机数据
-----------

.. code:: python
>>> from fishbase.fish_random import gen_random_id_card
>>> # 随机生成一个身份证号
>>> print(gen_random_id_card())
['3101091986******47']
>>> from fishbase.fish_random import gen_random_bank_card
>>> # 随机生成一个中国银行的信用卡卡号
>>> print(gen_random_bank_card('中国银行', 'CC'))
625907379******1
创建项目结构
Expand All @@ -114,20 +120,9 @@ fishbase 能干什么?
['requirements.txt', 'README.md', 'setup.py']
校验身份证号
----------------

.. code:: python
>>> from fishbase.fish_data import check_id_number
>>> # 简单校验身份证号
>>> print(check_id_number('320124198701010012'))
(False,)
更多
====

想看看我们还实现了些啥?请戳这里:http://fishbase.readthedocs.io/
更多详细文档,请参见:http://fishbase.readthedocs.io/

如果您有好点子,希望我们帮忙实现,请戳这里:https://github.com/chinapnr/fishbase/issues
如有好的建议,欢迎提 issue :https://github.com/chinapnr/fishbase/issues
12 changes: 6 additions & 6 deletions docs/change_log.rst
@@ -1,14 +1,14 @@
更新记录
===========================
2019.01.06 v1.1.6

2019.01.22 v1.1.6
---------------------------
* `#192 <https://github.com/chinapnr/fishbase/issues/192>`_, data, add function :meth:`fish_data.IdCard.get_cn_idcard`, :meth:`fish_data.IdCard.get_note_by_province`, doc and unittest;
* `#190 <https://github.com/chinapnr/fishbase/issues/190>`_, random, edit function :meth:`fish_random.gen_float_by_range`, optimize;
* `#152 <https://github.com/chinapnr/fishbase/issues/152>`_, random, edit function :meth:`fish_common.GetMD5` :meth:`fish_common.GetSha256`
:meth:`fish_common.splice_url_params` :meth:`fish_common.sorted_list_from_dict` :meth:`fish_common.is_contain_special_char`
:meth:`fish_common.if_any_elements_is_space` :meth:`fish_common.remove_duplicate_elements` :meth:`fish_common.sorted_objs_by_attr`
:meth:`fish_common.get_group_list_data` :meth:`fish_common.if_any_elements_is_letter` :meth:`fish_common.transform_hump_to_underline`,
optimize;
* `#152 <https://github.com/chinapnr/fishbase/issues/152>`_, random, edit function :meth:`fish_common.GetMD5` :meth:`fish_common.GetSha256` :meth:`fish_common.splice_url_params` :meth:`fish_common.sorted_list_from_dict` :meth:`fish_common.is_contain_special_char` :meth:`fish_common.if_any_elements_is_space` :meth:`fish_common.remove_duplicate_elements` :meth:`fish_common.sorted_objs_by_attr` :meth:`fish_common.get_group_list_data` :meth:`fish_common.if_any_elements_is_letter` :meth:`fish_common.transform_hump_to_underline`, optimize;
* `#204 <https://github.com/chinapnr/fishbase/issues/204>`_, random, edit function :meth:`fish_random.gen_random_id_card`, :meth:`fish_random.gen_random_address`, :meth:`fish_random.gen_random_bank_card`, :meth:`fish_random.gen_random_company_name`, :meth:`fish_random.gen_random_float`, :meth:`fish_random.gen_random_mobile`, :meth:`fish_random.gen_random_name`,optimize;
* `#200 <https://github.com/chinapnr/fishbase/issues/200>`_, random, edit function :meth:`fish_random.gen_random_str`, optimize;
* `#200 <https://github.com/chinapnr/fishbase/issues/200>`_, crypt, move fish_common.FishMD5 to :meth:`fish_crypt.FishMD5`, move fish_common.Base64 to :meth:`fish_crypt.Base64`, move fish_common.FishSha256 to :meth:`fish_crypt.FishSha256`


2018.12.31 v1.1.5
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Expand Up @@ -19,6 +19,7 @@
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../'))
sys.path.insert(0, os.path.abspath('../fishbase'))

# -- General configuration ------------------------------------------------
Expand Down
23 changes: 8 additions & 15 deletions docs/fish_common.rst
Expand Up @@ -3,29 +3,22 @@

.. autosummary::
fish_common.conf_as_dict
fish_common.SingleTon
fish_common.get_uuid
fish_common.GetMD5.string
fish_common.GetMD5.file
fish_common.GetMD5.big_file
fish_common.GetMD5.hmac_md5
fish_common.has_space_element
fish_common.if_json_contain
fish_common.SingleTon
fish_common.sorted_list_from_dict
fish_common.splice_url_params
fish_common.is_contain_special_char
fish_common.join_url_params
fish_common.has_special_char
fish_common.find_files
fish_common.hmac_sha256
fish_common.Base64.string
fish_common.Base64.file
fish_common.Base64.decode
fish_common.get_random_str
fish_common.if_any_elements_is_space
fish_common.remove_duplicate_elements
fish_common.sorted_objs_by_attr
fish_common.get_distinct_elements
fish_common.sort_objs_by_attr
fish_common.get_query_param_from_url
fish_common.get_sub_dict
fish_common.get_group_list_data
fish_common.transform_hump_to_underline
fish_common.paging
fish_common.camelcase_to_underline
fish_common.find_same_between_dicts
fish_common.yaml_conf_as_dict

Expand Down
16 changes: 16 additions & 0 deletions docs/fish_crypt.rst
@@ -0,0 +1,16 @@
``fish_crypt`` 加密数据函数包
====================================

.. autosummary::
fish_crypt.FishMD5.string
fish_crypt.FishMD5.file
fish_crypt.FishMD5.big_file
fish_crypt.FishMD5.hmac_md5
fish_crypt.FishSha256.hmac_sha256
fish_crypt.FishSha256.hashlib_sha256
fish_crypt.FishBase64.string
fish_crypt.FishBase64.file
fish_crypt.FishBase64.decode

.. automodule:: fish_crypt
:members:
17 changes: 14 additions & 3 deletions docs/fish_data.rst
@@ -1,5 +1,16 @@
``fish_data`` 系统相关函数包
====================================
``fish_data`` 数据信息处理函数包,含银行卡、身份证等
===================================================

.. autosummary::
fish_data.CardBin.get_checkcode
fish_data.CardBin.check_bankcard
fish_data.CardBin.get_bank_info
fish_data.CardBin.get_cardbin_info
fish_data.IdCard.get_checkcode
fish_data.IdCard.check_number
fish_data.IdCard.get_zone_info
fish_data.IdCard.get_areanote_info
fish_data.IdCard.get_province_info

.. automodule:: fish_data
:members:
:members:
4 changes: 2 additions & 2 deletions docs/fish_date.rst
@@ -1,5 +1,5 @@
``fish_date`` 基本函数包
=============================
``fish_date`` 日期处理增强函数包
===============================

.. autosummary::
fish_date.get_date_range
Expand Down
4 changes: 4 additions & 0 deletions docs/fish_file.rst
@@ -1,5 +1,9 @@
``fish_file`` 文件处理函数包
================================

.. autosummary::
fish_file.check_sub_path_create
fish_file.get_abs_filename_with_sub_path

.. automodule:: fish_file
:members:
6 changes: 5 additions & 1 deletion docs/fish_project.rst
@@ -1,5 +1,9 @@
``fish_project`` project 函数包
===============================

.. autosummary::
fish_project.init_project_by_yml


.. automodule:: fish_project
:members:
:members:
22 changes: 11 additions & 11 deletions docs/fish_random.rst
@@ -1,16 +1,16 @@
``fish_random`` 基本函数包
=============================
``fish_random`` 随机数据生成函数包
==================================

.. autosummary::
fish_random.gen_mobile
fish_random.gen_name
fish_random.gen_string_by_range
fish_random.get_random_zone_name
fish_random.gen_float_by_range
fish_random.gen_address
fish_random.gen_bank_card
fish_random.gen_id
fish_random.gen_company_name
fish_random.gen_random_address
fish_random.get_random_areanote
fish_random.gen_random_bank_card
fish_random.gen_random_company_name
fish_random.gen_random_float
fish_random.gen_random_id_card
fish_random.gen_random_mobile
fish_random.gen_random_name
fish_random.gen_random_str


.. automodule:: fish_random
Expand Down
5 changes: 4 additions & 1 deletion docs/fish_system.rst
@@ -1,5 +1,8 @@
``fish_system`` 系统相关函数包
====================================

.. autosummary::
fish_system.get_platform

.. automodule:: fish_system
:members:
:members:

0 comments on commit 9f8a16e

Please sign in to comment.