Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frozen/scalafn
https://github.com/frozen/scalafn
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/frozen/scalafn
- Owner: Frozen
- Created: 2014-07-31T09:15:55.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-17T10:37:19.000Z (over 9 years ago)
- Last Synced: 2023-04-04T07:22:11.682Z (over 1 year ago)
- Language: Python
- Size: 285 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
****************************************
Scalafn: scala-like lists usage
****************************************============
Installation
============pip install git+git://github.com/Frozen/scalafn.git@master
=====
Usage
=====.. code-block:: python
from scalafn import List
str1 = """[email protected] R=dnslookup """ \
"""T=remote_smtp H=mx.yandex.ru [127.0.0.1] """ \
"""X=TLS1.0:RSA_AES_256_CBC_SHA1:32"""
str2 = """<> R=1XSUTD-0008L9-Vn U=Debian-exim """ \
"""P=local S=5035 T="Mail delivery failed: """ \
"""returning message to sender" for [email protected]"""
import rers1 = List(*re.split(" (?=\w=)", str1)).\
filter(lambda x: x.count("=")).\
toMap(lambda x: x.split("=", 1))assert rs1 == dict(
R='dnslookup',
T='remote_smtp',
H='mx.yandex.ru [127.0.0.1]',
X='TLS1.0:RSA_AES_256_CBC_SHA1:32'
)rs2 = List(*re.split(" (?=\w=)", str2)).\
filter(lambda x: x.count("=")).\
toMap(lambda x: x.split("=", 1))assert rs2 == dict(
R='1XSUTD-0008L9-Vn',
U='Debian-exim',
P='local',
S='5035',
T='"Mail delivery failed: returning message to sender" for [email protected]'
)