Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI and poetry #27

Merged
merged 8 commits into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dist: focal

notifications:
email:
on_success: change
Expand All @@ -7,18 +9,19 @@ sudo: false
language: python
matrix:
include:
- python: '2.7'
- python: '3.5'
- python: '3.6'
- python: '3.7'
- python: '3.8-dev'
- python: '3.7'
- python: "2.7"
- python: "3.5"
- python: "3.6"
- python: "3.7"
- python: "3.8"
- python: "3.9-dev"
- python: "3.8"
env: TOXENV=flake8

install:
- pip install -U pip wheel
- pip install -U Cython
- pip install -U tox-travis tox
- pip install -U tox-travis tox poetry==1.1.0

script:
- tox
32 changes: 16 additions & 16 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

# -- Project information -----------------------------------------------------

project = 'BisTiming'
copyright = '2019, Ian Lin'
author = 'Ian Lin'
project = "BisTiming"
copyright = "2019, Ian Lin"
author = "Ian Lin"

# The full version, including alpha/beta/rc tags
release = bistiming.__version__
Expand All @@ -33,11 +33,11 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.todo',
'sphinx.ext.napoleon',
'sphinx.ext.intersphinx',
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.todo",
"sphinx.ext.napoleon",
"sphinx.ext.intersphinx",
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -48,12 +48,12 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------
Expand All @@ -65,9 +65,9 @@
html_theme = "sphinx_rtd_theme"

html_theme_options = {
'canonical_url': 'https://bistiming.readthedocs.io/en/latest/',
"canonical_url": "https://bistiming.readthedocs.io/en/latest/",
# Toc options
'collapse_navigation': False,
"collapse_navigation": False,
}

html_context = {
Expand Down Expand Up @@ -99,9 +99,9 @@
napoleon_use_rtype = True

intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'six': ('https://six.readthedocs.io/', None),
'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None),
"python": ("https://docs.python.org/3/", None),
"six": ("https://six.readthedocs.io/", None),
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
}

# -- Options for todo extension ----------------------------------------------
Expand All @@ -110,4 +110,4 @@
todo_include_todos = True


master_doc = 'index'
master_doc = "index"
8 changes: 5 additions & 3 deletions examples/multistopwatch_examples.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
from __future__ import print_function, division, absolute_import, unicode_literals

from time import sleep
import pprint

from six.moves import range

from bistiming import MultiStopwatch


def basic_example():
timers = MultiStopwatch(2, verbose=False)
for i in range(5):
for i in range(2):
for _ in range(5):
for _ in range(2):
with timers[0]:
sleep(0.1)
with timers[1]:
Expand All @@ -26,5 +28,5 @@ def main():
basic_example()


if __name__ == '__main__':
if __name__ == "__main__":
main()
31 changes: 22 additions & 9 deletions examples/stopwatch_examples.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from __future__ import print_function, division, absolute_import, unicode_literals

from time import sleep
import logging

from bistiming import Stopwatch


logging.basicConfig(
level=logging.DEBUG,
format="[%(asctime)s] %(levelname)s: %(name)s: %(message)s")
level=logging.DEBUG, format="[%(asctime)s] %(levelname)s: %(name)s: %(message)s"
)
logger = logging.getLogger(__name__)


Expand All @@ -26,23 +27,33 @@ def basic_example():
timer.log_elapsed_time() # 0:00:00.2
timer.split() # 0:00:00.2
timer.log_elapsed_time() # 0:00:00
print("timer.get_cumulative_elapsed_time():", timer.get_cumulative_elapsed_time()) # 0:00:00.2
print(
"timer.get_cumulative_elapsed_time():", timer.get_cumulative_elapsed_time()
) # 0:00:00.2
sleep(0.1)
timer.start()
sleep(0.1)
timer.log_elapsed_time() # 0:00:00.1
print("timer.get_cumulative_elapsed_time():", timer.get_cumulative_elapsed_time()) # 0:00:00.3
print(
"timer.get_cumulative_elapsed_time():", timer.get_cumulative_elapsed_time()
) # 0:00:00.3
timer.split() # 0:00:00.1
sleep(0.1)
timer.pause()
timer.split() # 0:00:00.1
print("timer.get_cumulative_elapsed_time():", timer.get_cumulative_elapsed_time()) # 0:00:00.4
print("timer.split_elapsed_time:", [str(delta) for delta in timer.split_elapsed_time])
print(
"timer.get_cumulative_elapsed_time():", timer.get_cumulative_elapsed_time()
) # 0:00:00.4
print(
"timer.split_elapsed_time:", [str(delta) for delta in timer.split_elapsed_time]
)
# [0:00:00.2, 0:00:00.1, 0:00:00.1]
timer.reset()

timer.log_elapsed_time() # 0:00:00
print("timer.get_cumulative_elapsed_time():", timer.get_cumulative_elapsed_time()) # 0:00:00
print(
"timer.get_cumulative_elapsed_time():", timer.get_cumulative_elapsed_time()
) # 0:00:00
print("timer.split_elapsed_time:", timer.split_elapsed_time) # []
sleep(0.1)
timer.start()
Expand Down Expand Up @@ -105,7 +116,9 @@ def logging_level_example():


def cumulative_elapsed_time_example():
print("[cumulative_elapsed_time_example] use python logging module with different log level")
print(
"[cumulative_elapsed_time_example] use python logging module with different log level"
)
timer = Stopwatch("Waiting")
with timer:
sleep(1)
Expand Down Expand Up @@ -144,5 +157,5 @@ def main():
cumulative_elapsed_time_example()


if __name__ == '__main__':
if __name__ == "__main__":
main()
Loading