Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
abranhe committed Aug 31, 2018
0 parents commit 7ff7a04
Show file tree
Hide file tree
Showing 8 changed files with 276 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# EditorConfig
# https://EditorConfig.org
#
# Build with init-editorconfig
# https://github.com/abranhe/init-editorconfig

root = true

[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.yml]
indent_style = space
indent_size = 2
104 changes: 104 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
sudo: false

language: python

python:
- "2.7"
- "3.3"
- "3.4"

install:
- pip install codecov

script:
- coverage run test.py
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Abraham Hernandez <abraham@abranhe.com> (abranhe.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<p align="center" id="top">
<a href="https://pypi.org/project/sta"><img src="https://cdn.abraham.gq/projects/sta/logo.svg"></a>
<br>
<br>
<br>
<a href="https://pypi.org/project/sta"><b>sta</b></a>
: Parse tokens from an string into an array
</p>

<p align="center">
<!-- Travis CI -->
<a href="https://travis-ci.org/abranhe/sta"><img src="https://img.shields.io/travis/abranhe/sta.svg?logo=travis" /></a>
<!-- LICENSE -->
<a href="https://github.com/abranhe/sta/blob/master/LICENSE"><img src="https://img.shields.io/github/license/abranhe/sta.svg" /></a>
<!-- @abranhe -->
<a href="https://github.com/abranhe"><img src="https://abranhe.com/badge.svg"></a>
<!-- Cash me -->
<a href="https://cash.me/$abranhe"><img src="https://cdn.abraham.gq/badges/cash-me.svg"></a>
<!-- Patreon -->
<a href="https://www.patreon.com/abranhe"><img src="https://cdn.abraham.gq/badges/patreon.svg" /></a>
<!-- Paypal -->
<a href="https://paypal.me/abranhe/10"><img src="https://cdn.abraham.gq/badges/paypal.svg" /></a>
</p>

# Overview

[**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.

# Install

```
pip install sta
```

# Usage

```py
import sta

print(sta('this string is divided by spaces'))
# => [ 'this', 'string', 'is', 'divided', 'by', 'spaces' ]
```

# Related

- [str-to-arr](https://github.com/abranhe/str-to-arr): convert an string into an array in JavaScript.
- [s-to-o](https://github.com/abranhe/s-to-o): convert an string into an object in JavaScript.

# Team

|[![Carlos Abraham Logo](https://avatars3.githubusercontent.com/u/21347264?s=50&v=4)](https://19cah.com)|
| :-: |
| [Carlos Abraham](https://github.com/abranhe) |

# License

[MIT](https://github.com/abranhe/sta/blob/master/LICENSE) License © [Carlos Abraham](https://github.com/abranhe/)
31 changes: 31 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import setuptools
import sys

with open("README.md", "r") as readme:
long_description = readme.read()

setuptools.setup(
name = "sta",
packages = ["sta"],
long_description = long_description,
long_description_content_type = "text/markdown",
version = "2.0.0",
description = "Parse tokens from an string into an array",
author = "Carlos Abraham",
author_email = "abraham@abranhe.com",
url = "https://abranhe.com",
classifiers = (
"Programming Language :: Python",
"Natural Language :: English",
"Environment :: Plugins",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
),
project_urls = {
'Source': 'https://github.com/abranhe/sta',
},
)
12 changes: 12 additions & 0 deletions sta/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import sys

class sta(object):
def __call__(self, str):
arr = []
words = str.strip().split(' ')

for word in words:
arr.append(word)
return arr

sys.modules[__name__] = sta()
19 changes: 19 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import sta
import unittest

strArr = 'a dsf sd rw as; '

class TestFirst(unittest.TestCase):
def test(self):
self.assertEqual(sta(strArr)[0], 'a')

class TestLast(unittest.TestCase):
def test(self):
self.assertEqual(sta(strArr)[4], 'as;')

class TestLength(unittest.TestCase):
def test(self):
self.assertEqual(len(sta(strArr)), 5)

if __name__ == '__main__':
unittest.main()

0 comments on commit 7ff7a04

Please sign in to comment.