rename pylib to pydu

This commit is contained in:
Prodesire 2017-10-06 23:59:14 +08:00
parent 8d605f8e55
commit f653155c3f
18 changed files with 120 additions and 38 deletions

View File

@ -1,8 +1,8 @@
# pylib
[![Build Status](https://travis-ci.org/Prodesire/pylib.svg?branch=master)](https://travis-ci.org/Prodesire/pylib)
[![Coverage Status](https://coveralls.io/repos/github/Prodesire/pylib/badge.svg?branch=master)](https://coveralls.io/github/Prodesire/pylib?branch=master)
# pydu
[![Build Status](https://travis-ci.org/Prodesire/pydu.svg?branch=master)](https://travis-ci.org/Prodesire/pydu)
[![Coverage Status](https://coveralls.io/repos/github/Prodesire/pydu/badge.svg?branch=master)](https://coveralls.io/github/Prodesire/pydu?branch=master)
**pylib** (python library) is a library of useful data structures and utils
**pydu** (python library) is a library of useful data structures and utils
for Python 2 and 3, which collected from open source projects and created by
contributors.

View File

@ -4,7 +4,7 @@
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = pylib
SPHINXPROJ = pydu
SOURCEDIR = .
BUILDDIR = _build

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pylib documentation build configuration file, created by
# pydu documentation build configuration file, created by
# sphinx-quickstart on Fri Oct 6 23:05:59 2017.
#
# This file is execfile()d with the current directory set to its
@ -46,7 +46,7 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = 'pylib'
project = 'pydu'
copyright = '2017, Prodesire'
author = 'Prodesire'
@ -115,7 +115,7 @@ html_sidebars = {
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'pylib-doc'
htmlhelp_basename = 'pydu-doc'
# -- Options for LaTeX output ---------------------------------------------
@ -142,7 +142,7 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'pylib.tex', 'pylib Documentation',
(master_doc, 'pydu.tex', 'pydu Documentation',
'Prodesire', 'manual'),
]
@ -152,7 +152,7 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'pylib', 'pylib Documentation',
(master_doc, 'pydu', 'pydu Documentation',
[author], 1)
]
@ -163,8 +163,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'pylib', 'pylib Documentation',
author, 'pylib', 'One line description of project.',
(master_doc, 'pydu', 'pydu Documentation',
author, 'pydu', 'One line description of project.',
'Miscellaneous'),
]

View File

@ -1,21 +1,21 @@
.. pylib documentation master file, created by
.. pydu documentation master file, created by
sphinx-quickstart on Fri Oct 6 23:05:59 2017.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
pylib documentation
pydu documentation
===================
About
-----
**pylib** (python library) is a library of useful data structures and utils
**pydu** (python library) is a library of useful data structures and utils
for Python 2 and 3, which collected from open source projects and created by
contributors.
It is with Python versions from **2.7 to 3.6**.
The pylib documentation you're reading is distributed as a single HTML page.
The pydu documentation you're reading is distributed as a single HTML page.
Data Structures
@ -24,12 +24,48 @@ Data Structures
Dict
----
.. class:: pylib.structures.AttrDict(seq=None, **kwargs)
.. class:: pydu.structures.AttrDict(seq=None, **kwargs)
A AttrDict object is like a dictionary except `obj.foo` can be used
in addition to `obj['foo']`.
>>> from pylib.structures import AttrDict
>>> from pydu.structures import AttrDict
>>> o = AttrDict(a=1)
o.a
1
>>> o['a']
1
>>> o.a = 2
>>> o['a']
2
>>> del o.a
>>> o.a
Traceback (most recent call last):
...
AttributeError: 'a'
>>> from pydu.structures import AttrDict
>>> o = AttrDict(a=1)
o.a
1
>>> o['a']
1
>>> o.a = 2
>>> o['a']
2
>>> del o.a
>>> o.a
Traceback (most recent call last):
...
AttributeError: 'a'
>>> from pydu.structures import AttrDict
>>> o = AttrDict(a=1)
o.a
1
@ -45,7 +81,7 @@ Dict
AttributeError: 'a'
.. class:: pylib.structures.CaseInsensitiveDict(data=None, **kwargs)
.. class:: pydu.structures.CaseInsensitiveDict(data=None, **kwargs)
A case-insensitive ``dict``-like object.
Implements all methods and operations of ``collections.MutableMapping``
@ -53,9 +89,33 @@ Dict
All keys are expected to be strings. The structure remembers the
case of the last key to be set, and ``iter(instance)``, ``keys()``,
``items()``, ``iterkeys()``, and ``iteritems()`` will contain
case-sensitive keys.
>>> from pydu.structures import CaseInsensitiveDict
>>> cid = CaseInsensitiveDict()
>>> cid['Accept'] = 'application/json'
>>> cid['aCCEPT'] == 'application/json'
True
>>> list(cid) == ['Accept']
True
case-sensitive keys.
>>> from pydu.structures import CaseInsensitiveDict
>>> cid = CaseInsensitiveDict()
>>> cid['Accept'] = 'application/json'
>>> cid['aCCEPT'] == 'application/json'
True
>>> list(cid) == ['Accept']
True
case-sensitive keys.
>>> from pylib.structures import CaseInsensitiveDict
>>> from pydu.structures import CaseInsensitiveDict
>>> cid = CaseInsensitiveDict()
>>> cid['Accept'] = 'application/json'
>>> cid['aCCEPT'] == 'application/json'
@ -64,11 +124,33 @@ Dict
True
.. class:: pylib.structures.LookupDict(name=None)
.. class:: pydu.structures.LookupDict(name=None)
Dictionary lookup object.
>>> from pylib.structures import LookupDict
>>> from pydu.structures import LookupDict
>>> d = LookupDict()
>>> d['key']
None
>>> d['key'] = 1
>>> d['key']
1
>>> from pydu.structures import LookupDict
>>> d = LookupDict()
>>> d['key']
None
>>> d['key'] = 1
>>> d['key']
1
>>> from pydu.structures import LookupDict
>>> d = LookupDict()
>>> d['key']
None

View File

@ -9,7 +9,7 @@ if "%SPHINXBUILD%" == "" (
)
set SOURCEDIR=.
set BUILDDIR=_build
set SPHINXPROJ=pylib
set SPHINXPROJ=pydu
if "%1" == "" goto help

View File

@ -1,11 +1,11 @@
from setuptools import setup, find_packages
setup(
name="pylib",
name="pydu",
version="0.0.1",
description="pylib",
description="pydu",
author="Prodesire",
url="https://github.com/Prodesire/pylib",
url="https://github.com/Prodesire/pydu",
setup_requires=['pytest-runner'],
packages=find_packages(),
)

View File

@ -1,5 +1,5 @@
import pytest
from pylib.structures import AttrDict
from pydu.structures import AttrDict
def test_attr_access_with_init():

View File

@ -1,5 +1,5 @@
import pytest
from pylib.structures import CaseInsensitiveDict
from pydu.structures import CaseInsensitiveDict
@pytest.fixture(scope='function')

View File

@ -1,5 +1,5 @@
import pytest
from pylib.structures import LookupDict
from pydu.structures import LookupDict
@pytest.fixture(scope='function')

View File

@ -1,5 +1,5 @@
from pylib.py3helpers import (iterkeys, itervalues, iteritems, is_iter,
text_type, string_types, numeric_types)
from pydu.py3helpers import (iterkeys, itervalues, iteritems, is_iter,
text_type, string_types, numeric_types)
def test_iter():
@ -27,8 +27,8 @@ def test_types():
def test_urljoin():
from pylib.py3helpers import urljoin
from pydu.py3helpers import urljoin
def test_imap():
from pylib.py3helpers import imap
from pydu.py3helpers import imap

View File

@ -1,5 +1,5 @@
from pylib.structures import AttrDict
from pylib.utils import attrdictify
from pydu.structures import AttrDict
from pydu.utils import attrdictify
def test_attrdictify():

View File

@ -1,5 +1,5 @@
# coding: utf-8
from pylib.utils import safestr, safeunicode
from pydu.utils import safestr, safeunicode
def test_safestr():

View File

@ -1,4 +1,4 @@
from pylib.utils import strips, lstrips, rstrips
from pydu.utils import strips, lstrips, rstrips
def test_lstrips():

View File

@ -5,5 +5,5 @@ envlist = py{36}
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
deps=-rrequirements-dev.txt
commands=
coverage run --source=pylib -m pytest
coverage run --source=pydu -m pytest
coveralls