Skip to content

Commit 7ff7a04

Browse files
committed
init
0 parents  commit 7ff7a04

File tree

8 files changed

+276
-0
lines changed

8 files changed

+276
-0
lines changed

.editorconfig

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# EditorConfig
2+
# https://EditorConfig.org
3+
#
4+
# Build with init-editorconfig
5+
# https://github.com/abranhe/init-editorconfig
6+
7+
root = true
8+
9+
[*]
10+
indent_style = tab
11+
end_of_line = lf
12+
charset = utf-8
13+
trim_trailing_whitespace = true
14+
insert_final_newline = true
15+
16+
[*.yml]
17+
indent_style = space
18+
indent_size = 2

.gitignore

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
MANIFEST
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
.hypothesis/
48+
.pytest_cache/
49+
50+
# Translations
51+
*.mo
52+
*.pot
53+
54+
# Django stuff:
55+
*.log
56+
local_settings.py
57+
db.sqlite3
58+
59+
# Flask stuff:
60+
instance/
61+
.webassets-cache
62+
63+
# Scrapy stuff:
64+
.scrapy
65+
66+
# Sphinx documentation
67+
docs/_build/
68+
69+
# PyBuilder
70+
target/
71+
72+
# Jupyter Notebook
73+
.ipynb_checkpoints
74+
75+
# pyenv
76+
.python-version
77+
78+
# celery beat schedule file
79+
celerybeat-schedule
80+
81+
# SageMath parsed files
82+
*.sage.py
83+
84+
# Environments
85+
.env
86+
.venv
87+
env/
88+
venv/
89+
ENV/
90+
env.bak/
91+
venv.bak/
92+
93+
# Spyder project settings
94+
.spyderproject
95+
.spyproject
96+
97+
# Rope project settings
98+
.ropeproject
99+
100+
# mkdocs documentation
101+
/site
102+
103+
# mypy
104+
.mypy_cache/

.travis.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
sudo: false
2+
3+
language: python
4+
5+
python:
6+
- "2.7"
7+
- "3.3"
8+
- "3.4"
9+
10+
install:
11+
- pip install codecov
12+
13+
script:
14+
- coverage run test.py

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Abraham Hernandez <abraham@abranhe.com> (abranhe.com)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<p align="center" id="top">
2+
<a href="https://pypi.org/project/sta"><img src="https://cdn.abraham.gq/projects/sta/logo.svg"></a>
3+
<br>
4+
<br>
5+
<br>
6+
<a href="https://pypi.org/project/sta"><b>sta</b></a>
7+
: Parse tokens from an string into an array
8+
</p>
9+
10+
<p align="center">
11+
<!-- Travis CI -->
12+
<a href="https://travis-ci.org/abranhe/sta"><img src="https://img.shields.io/travis/abranhe/sta.svg?logo=travis" /></a>
13+
<!-- LICENSE -->
14+
<a href="https://github.com/abranhe/sta/blob/master/LICENSE"><img src="https://img.shields.io/github/license/abranhe/sta.svg" /></a>
15+
<!-- @abranhe -->
16+
<a href="https://github.com/abranhe"><img src="https://abranhe.com/badge.svg"></a>
17+
<!-- Cash me -->
18+
<a href="https://cash.me/$abranhe"><img src="https://cdn.abraham.gq/badges/cash-me.svg"></a>
19+
<!-- Patreon -->
20+
<a href="https://www.patreon.com/abranhe"><img src="https://cdn.abraham.gq/badges/patreon.svg" /></a>
21+
<!-- Paypal -->
22+
<a href="https://paypal.me/abranhe/10"><img src="https://cdn.abraham.gq/badges/paypal.svg" /></a>
23+
</p>
24+
25+
# Overview
26+
27+
[**sta**](https://pypi.org/project/sta) extract the words from a string, and store those words in an array. The words are separated by an space/s.
28+
29+
# Install
30+
31+
```
32+
pip install sta
33+
```
34+
35+
# Usage
36+
37+
```py
38+
import sta
39+
40+
print(sta('this string is divided by spaces'))
41+
# => [ 'this', 'string', 'is', 'divided', 'by', 'spaces' ]
42+
```
43+
44+
# Related
45+
46+
- [str-to-arr](https://github.com/abranhe/str-to-arr): convert an string into an array in JavaScript.
47+
- [s-to-o](https://github.com/abranhe/s-to-o): convert an string into an object in JavaScript.
48+
49+
# Team
50+
51+
|[![Carlos Abraham Logo](https://avatars3.githubusercontent.com/u/21347264?s=50&v=4)](https://19cah.com)|
52+
| :-: |
53+
| [Carlos Abraham](https://github.com/abranhe) |
54+
55+
# License
56+
57+
[MIT](https://github.com/abranhe/sta/blob/master/LICENSE) License © [Carlos Abraham](https://github.com/abranhe/)

setup.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import setuptools
2+
import sys
3+
4+
with open("README.md", "r") as readme:
5+
long_description = readme.read()
6+
7+
setuptools.setup(
8+
name = "sta",
9+
packages = ["sta"],
10+
long_description = long_description,
11+
long_description_content_type = "text/markdown",
12+
version = "2.0.0",
13+
description = "Parse tokens from an string into an array",
14+
author = "Carlos Abraham",
15+
author_email = "abraham@abranhe.com",
16+
url = "https://abranhe.com",
17+
classifiers = (
18+
"Programming Language :: Python",
19+
"Natural Language :: English",
20+
"Environment :: Plugins",
21+
"Intended Audience :: Developers",
22+
"License :: OSI Approved :: MIT License",
23+
'Programming Language :: Python :: 3',
24+
'Programming Language :: Python :: 3.2',
25+
'Programming Language :: Python :: 3.3',
26+
'Programming Language :: Python :: 3.4',
27+
),
28+
project_urls = {
29+
'Source': 'https://github.com/abranhe/sta',
30+
},
31+
)

sta/__init__.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import sys
2+
3+
class sta(object):
4+
def __call__(self, str):
5+
arr = []
6+
words = str.strip().split(' ')
7+
8+
for word in words:
9+
arr.append(word)
10+
return arr
11+
12+
sys.modules[__name__] = sta()

test.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import sta
2+
import unittest
3+
4+
strArr = 'a dsf sd rw as; '
5+
6+
class TestFirst(unittest.TestCase):
7+
def test(self):
8+
self.assertEqual(sta(strArr)[0], 'a')
9+
10+
class TestLast(unittest.TestCase):
11+
def test(self):
12+
self.assertEqual(sta(strArr)[4], 'as;')
13+
14+
class TestLength(unittest.TestCase):
15+
def test(self):
16+
self.assertEqual(len(sta(strArr)), 5)
17+
18+
if __name__ == '__main__':
19+
unittest.main()

0 commit comments

Comments
 (0)