Skip to content

Commit

Permalink
added hidden files
Browse files Browse the repository at this point in the history
  • Loading branch information
costastf committed May 9, 2017
0 parents commit ccde415
Show file tree
Hide file tree
Showing 122 changed files with 20,887 additions and 0 deletions.
1 change: 1 addition & 0 deletions .VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
### MANAGED START ###
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
end_of_line = lf

[*.bat]
indent_style = tab
end_of_line = crlf

[LICENSE]
insert_final_newline = false

[Makefile]
indent_style = tab

### MANAGED STOP ###
57 changes: 57 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
### MANAGED START ###
# Packages
*.egg
*.egg-info
/dist/
/build/
/eggs/
/parts/
/var/
/sdist/
/develop-eggs/
.installed.cfg
/lib/
/lib64/

*.py[cod]

# C extensions
*.so

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
nosetests.xml
htmlcov
test-output

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# Complexity
output/*.html
output/*/index.html

# Sphinx
docs/_build

# pyCharm
.idea

# VirtualEnv
env
env*

# Mac
.DS_Store


### MANAGED STOP ###
6 changes: 6 additions & 0 deletions .prospector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pep257:
disable:
- D203
ignore-paths:
- _CI
- build
17 changes: 17 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
=======
Credits
=======

Very loosely based on https://github.com/OVChip/ovchipapi-python for the
authentication part.


Development Lead
----------------

* Costas Tyfoxylos <[email protected]>

Contributors
------------

None yet. Why not be the first?
43 changes: 43 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
============
Contributing
============

Contributions are welcome, and they are greatly appreciated! Every
little bit helps, and credit will always be given.

Submit Feedback
~~~~~~~~~~~~~~~

If you are proposing a feature:

* Explain in detail how it would work.
* Keep the scope as narrow as possible, to make it easier to implement.

Get Started!
------------

Ready to contribute? Here's how to set up `ovchipcardlib` for local development.

1. Clone your fork locally::

$ git clone https://github.com/costastf/ovchipcardlib.git

2. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your clone for local development::

$ mkvirtualenv ovchipcardlib
$ cd ovchipcardlib/
$ python setup.py develop

3. Create a branch for local development::

$ git checkout -b name-of-your-bugfix-or-feature

Now you can make your changes locally.

4. Commit your changes and push your branch to the server::

$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature

5. Submit a merge request
9 changes: 9 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. :changelog:
History
-------

0.1 (14-04-2017)
---------------------

* First release on pypi
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) 2017 Costas Tyfoxylos

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.
16 changes: 16 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
include .VERSION
include AUTHORS.rst
include CONTRIBUTING.rst
include HISTORY.rst
include LICENSE
include README.rst
include USAGE.rst
include requirements.txt
include ovchipcardlib/.VERSION
recursive-include requirements *.txt


recursive-exclude * __pycache__
recursive-exclude * *.py[co]

recursive-include docs *.rst conf.py Makefile
33 changes: 33 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
=============
ovchipcardlib
=============

A library to interact with the ov-chip card service.

It utilizes the webapi of the mobile apps to get the information.
Very loosely based on https://github.com/OVChip/ovchipapi-python for the
authentication part.

Be aware that the ov-chip card system used in the Netherlands for public
transport was not designed to be real time. So expect a hefty time drift
before the actual checkin/out action and information showing up on the api
and by extension on the transactions list.

Also the sequence of transactions is not guaranteed. It is absolutelly
certain that if there are a lot of checkins/outs closely together they will
appear out of order on the web api. Apparently there is a serverside job that
sorts them once a day.

The library handles that by sorting the list of transactions always. So on
any action it would return a properly ordered list of events but in case of
monitoring through the card.get_latest_transactions() method it is
absolutelly guaranteed that transaction will appear out of order and with a
delay ranging between 2 and 15 minutes according to some simple benchmarks.


* Documentation: http://ovchipcardlib.readthedocs.io/en/latest/

Features
--------

* Can get cards bound with the account and lists of transactions for the cards.
36 changes: 36 additions & 0 deletions USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
=====
Usage
=====

To use ovchipcardlib in a project in an event watching loop you could use the
following code.

.. code-block:: python
from ovchipcardlib import Service
from time import sleep
from datetime import datetime
ovchip_username = 'OVCHIP_USERNAME'
ovchip_password = 'OVCHIP_PASSWORD'
card_name = 'Mijn OV-Chipkaart'
service = Service(ovchip_username, ovchip_password)
card = service.get_card_by_alias(card_name)
print('Monitoring card with number {}'.format(card.number))
print('Getting all historic transactions') # here we discard all the old
# ones since we want to monitor
card.get_latest_transactions()
print('Got all transactions. Entering the monitoring loop...')
while True:
for transaction in card.get_latest_transactions():
now = datetime.now()
time_shift = now - transaction.datetime
delay_message = 'Delay of transaction logging :{}'.format(time_shift)
body = '\n'.join((str(transaction), delay_message))
print('Transaction logged at {}'.format(now))
print(body)
print(delay_message)
sleep(60)
22 changes: 22 additions & 0 deletions _CI/scripts/bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
cd $(dirname $0)/../..

source $(which virtualenvwrapper.sh)

[ -z "$WORKON_HOME" ] && WORKON_HOME=$HOME/.virtualenvs

if (! test -d "$WORKON_HOME/ovchipcardlib")
then
echo "Creating virtual env for ovchipcardlib"
if (! mkvirtualenv "ovchipcardlib" )
then
echo "Missing prerequisite virtualenvwrapper, bailing out"
exit 1
fi
fi

echo "Working on virtualenv ovchipcardlib"
source "$WORKON_HOME/ovchipcardlib/bin/activate"

echo "Installing python package requirements.."
pip install -r requirements.txt
26 changes: 26 additions & 0 deletions _CI/scripts/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash --login
set -e
cd $(dirname $0)/../..

. _CI/scripts/bootstrap

rm -rf build dist

# we want all these files to exist in the actual package
cp .VERSION ovchipcardlib/.VERSION
cp LICENSE ovchipcardlib/LICENSE
cp AUTHORS.rst ovchipcardlib/AUTHORS.rst
cp CONTRIBUTING.rst ovchipcardlib/CONTRIBUTING.rst
cp HISTORY.rst ovchipcardlib/HISTORY.rst
cp README.rst ovchipcardlib/README.rst
cp USAGE.rst ovchipcardlib/USAGE.rst

python setup.py sdist bdist_egg

rm ovchipcardlib/.VERSION
rm ovchipcardlib/LICENSE
rm ovchipcardlib/AUTHORS.rst
rm ovchipcardlib/CONTRIBUTING.rst
rm ovchipcardlib/HISTORY.rst
rm ovchipcardlib/README.rst
rm ovchipcardlib/USAGE.rst
21 changes: 21 additions & 0 deletions _CI/scripts/document
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash --login
cd $(dirname $0)/../..

. _CI/scripts/bootstrap
pip install -r requirements/documentation.txt

rm -f docs/test_docs.rst
rm -f docs/modules.rst
rm -rf _build docs/_build

echo "Running make docs.."

make -C docs html && \
mv -v docs/_build _build
exit_code=$?
if ([ $exit_code != 0 ])
then
echo "Failed building documentation"
exit exit_code
fi
open _build/html/index.html 2> /dev/null|| xdg-open _build/html/index.html 2> /dev/null
9 changes: 9 additions & 0 deletions _CI/scripts/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash --login
set -e
cd $(dirname $0)/../..

. _CI/scripts/bootstrap

pip install -r requirements/testing.txt

prospector -DFM && echo No issues found
15 changes: 15 additions & 0 deletions _CI/scripts/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash --login
cd $(dirname $0)/../..

. ./_CI/scripts/bootstrap

pip install -r requirements/testing.txt

rm -rf test-output
mkdir -p test-output
tox
exit_code=$?
open test-output/coverage/index.html 2> /dev/null|| xdg-open test-output/coverage/index.html &
sleep 1
open test-output/nosetests.html 2> /dev/null|| xdg-open test-output/nosetests.html &
exit $exit_code
26 changes: 26 additions & 0 deletions _CI/scripts/upload
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash --login
set -e
cd $(dirname $0)/../..

. _CI/scripts/bootstrap

rm -rf build dist

# we want all these files to exist in the actual package
cp .VERSION ovchipcardlib/.VERSION
cp LICENSE ovchipcardlib/LICENSE
cp AUTHORS.rst ovchipcardlib/AUTHORS.rst
cp CONTRIBUTING.rst ovchipcardlib/CONTRIBUTING.rst
cp HISTORY.rst ovchipcardlib/HISTORY.rst
cp README.rst ovchipcardlib/README.rst
cp USAGE.rst ovchipcardlib/USAGE.rst

python setup.py sdist bdist_egg upload -r pypi

rm ovchipcardlib/.VERSION
rm ovchipcardlib/LICENSE
rm ovchipcardlib/AUTHORS.rst
rm ovchipcardlib/CONTRIBUTING.rst
rm ovchipcardlib/HISTORY.rst
rm ovchipcardlib/README.rst
rm ovchipcardlib/USAGE.rst
Binary file added _build/doctrees/authors.doctree
Binary file not shown.
Binary file added _build/doctrees/contributing.doctree
Binary file not shown.
Binary file added _build/doctrees/history.doctree
Binary file not shown.
Binary file added _build/doctrees/index.doctree
Binary file not shown.
Binary file added _build/doctrees/installation.doctree
Binary file not shown.
Binary file added _build/doctrees/modules.doctree
Binary file not shown.
Binary file added _build/doctrees/ovchipcardlib.doctree
Binary file not shown.
Binary file added _build/doctrees/readme.doctree
Binary file not shown.
Binary file added _build/doctrees/usage.doctree
Binary file not shown.
Loading

0 comments on commit ccde415

Please sign in to comment.