Initial commit

This commit is contained in:
aewens 2020-03-12 13:17:08 -05:00
commit 872b5e51f6
8 changed files with 245 additions and 0 deletions

135
.gitignore vendored Normal file
View File

@ -0,0 +1,135 @@
# Application-specific
*.vim
*.swp
*.swo
NOTES
# 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/
pip-wheel-metadata/
share/python-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/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# 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/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/

14
.travis.yml Normal file
View File

@ -0,0 +1,14 @@
language: python
cache: pip
python:
- "3.6"
- "3.7"
- "3.8"
- "3.8-dev"
install:
- pip3 install mypy -r requirements.txt
script:
- pip3 freeze
- mypy ircstates
- python3 -m unittest test

26
LICENSE Normal file
View File

@ -0,0 +1,26 @@
Copyright (c) 2020 Austin Ewens. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

41
README.md Normal file
View File

@ -0,0 +1,41 @@
# ircstates
[![Build Status](https://travis-ci.org/aewens/ircevents.svg?branch=master)](https://travis-ci.org/aewens/ircevents)
## usage
### example code
```python
import ircstates, ircevents, socket
NICK = "nickname"
CHAN = "#chan"
HOST = "127.0.0.1"
POST = 6667
server = ircstates.Server("freenode")
sock = socket.socket()
sock.connect((HOST, POST))
def _send(s):
line = irctokens.tokenise(s)
server.send(line)
_send("USER test 0 * :test")
_send("NICK test321")
while True:
while server.pending():
send_lines = server.sent(sock.send(server.pending()))
for line in send_lines:
print(f"> {line.format()}")
recv_lines = server.recv(sock.recv(1024))
for line in recv_lines:
print(f"< {line.format()}")
# user defined behaviors...
if line.command == "001" and not "#test321" in server.channels:
_send("JOIN #test321")
```

1
VERSION Normal file
View File

@ -0,0 +1 @@
0.1.0

0
ircevents/__init__.py Normal file
View File

0
requirements.txt Normal file
View File

28
setup.py Normal file
View File

@ -0,0 +1,28 @@
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
with open("VERSION", "r") as version_file:
version = version_file.read().strip()
with open("requirements.txt", "r") as requirements_file:
install_requires = requirements_file.read().splitlines()
setuptools.setup(
name="ircevents",
version=version,
author="aewens",
author_email="email@aewens.com",
description="",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/aewens/ircevents",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Topic :: Communications :: Chat :: Internet Relay Chat"
],
python_requires='>=3.6',
install_requires=install_requires
)