Skip to content

Commit

Permalink
Upgrade dependencies and update runtime configs
Browse files Browse the repository at this point in the history
  • Loading branch information
joowani committed Feb 13, 2022
1 parent a4bd84c commit 7adba8d
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ 3.6, 3.7, 3.8, 3.9 ]
python-version: [ 3.7, 3.8, 3.9, 3.10 ]
steps:
- uses: actions/checkout@v2
- name: Fetch complete history for all tags and branches
Expand Down
12 changes: 7 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.1.0
hooks:
- id: check-case-conflict
- id: check-executables-have-shebangs
Expand All @@ -12,20 +12,22 @@ repos:
- id: end-of-file-fixer
- id: mixed-line-ending
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 22.1.0
hooks:
- id: black
- repo: https://github.com/timothycrosley/isort
rev: 5.7.0
rev: 5.10.1
hooks:
- id: isort
args: [ --profile, black ]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.790
rev: v0.931
hooks:
- id: mypy
files: ^binarytree/
additional_dependencies: [ types-all ]
args: [ --strict ]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
rev: 4.0.1
hooks:
- id: flake8
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![codecov](https://codecov.io/gh/joowani/binarytree/branch/main/graph/badge.svg?token=C2X2OMPL65)](https://codecov.io/gh/joowani/binarytree)
[![PyPI version](https://badge.fury.io/py/binarytree.svg)](https://badge.fury.io/py/binarytree)
[![GitHub license](https://img.shields.io/github/license/joowani/binarytree?color=brightgreen)](https://github.com/joowani/binarytree/blob/main/LICENSE)
![Python version](https://img.shields.io/badge/python-3.6%2B-blue)
![Python version](https://img.shields.io/badge/python-3.7%2B-blue)

Are you studying binary trees for your next exam, assignment or technical interview?

Expand All @@ -23,14 +23,14 @@ Binarytree can be used with [Graphviz](https://graphviz.org) and

## Requirements

Python 3.6+
Python 3.7+

## Installation

Install via [pip](https://pip.pypa.io):

```shell
pip install binarytree
pip install binarytree --upgrade
```

For [conda](https://docs.conda.io) users:
Expand Down
10 changes: 5 additions & 5 deletions binarytree/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def svg(self, node_radius: int = 16) -> str:

def scale_x(x: int, y: int) -> float:
diff = tree_height - y
x = 2 ** (diff + 1) * x + 2 ** diff - 1
x = 2 ** (diff + 1) * x + 2**diff - 1
return 1 + node_radius + scale * x / 2

def scale_y(y: int) -> float:
Expand Down Expand Up @@ -562,7 +562,7 @@ def add_node(node_x: int, node_y: int, node_value: NodeValue) -> None:
y += 1

return _SVG_XML_TEMPLATE.format(
width=scale * (2 ** tree_height),
width=scale * (2**tree_height),
height=scale * (2 + tree_height),
body="\n".join(xml),
)
Expand Down Expand Up @@ -1833,7 +1833,7 @@ def _generate_random_leaf_count(height: int) -> int:
:return: Random leaf count.
:rtype: int
"""
max_leaf_count = 2 ** height
max_leaf_count = 2**height
half_leaf_count = max_leaf_count // 2

# A very naive way of mimicking normal distribution
Expand Down Expand Up @@ -2016,7 +2016,7 @@ def _get_tree_properties(root: Node) -> NodeProperties:
size=size,
is_max_heap=is_complete and is_descending,
is_min_heap=is_complete and is_ascending,
is_perfect=leaf_count == 2 ** max_leaf_depth,
is_perfect=leaf_count == 2**max_leaf_depth,
is_strict=is_strict,
is_complete=is_complete,
leaf_count=leaf_count,
Expand Down Expand Up @@ -2486,7 +2486,7 @@ def heap(

if not is_perfect:
# Randomly cut some of the leaf nodes away
random_cut = random.randint(2 ** height, len(values))
random_cut = random.randint(2**height, len(values))
values = values[:random_cut]

if is_max:
Expand Down
6 changes: 3 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Binarytree: Python Library for Studying Binary Trees
:alt: GitHub License
:target: https://github.com/joowani/binarytree/blob/main/LICENSE

.. image:: https://img.shields.io/badge/python-3.6%2B-blue
.. image:: https://img.shields.io/badge/python-3.7%2B-blue
:alt: Python Versions

Welcome to the documentation for **binarytree**.
Expand All @@ -18,7 +18,7 @@ supported.
Requirements
============

Python 3.6+
Python 3.7+

Installation
============
Expand All @@ -27,7 +27,7 @@ Install via pip_:

.. code-block:: bash
pip install binarytree
pip install binarytree --upgrade
For conda_ users:

Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ testpaths = ["tests"]

[tool.setuptools_scm]
write_to = "binarytree/version.py"

[tool.mypy]
warn_return_any = true
warn_unused_configs = true
ignore_missing_imports = true
strict = true
4 changes: 0 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,3 @@ max-line-length = 88
extend-ignore = E203, E741, W503
exclude =.git .idea .*_cache dist htmlcov venv
per-file-ignores = __init__.py:F401 conf.py:E402

[mypy]
ignore_missing_imports = True
strict = True
20 changes: 10 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@
keywords=["tree", "heap", "bst", "education"],
packages=find_packages(exclude=["tests"]),
include_package_data=True,
python_requires=">=3.6",
python_requires=">=3.7",
license="MIT",
use_scm_version=True,
setup_requires=["setuptools_scm"],
install_requires=[
"graphviz",
"setuptools>=42",
"setuptools_scm[toml]>=3.4",
"setuptools>=60.8.2",
"setuptools_scm[toml]>=5.0.1",
],
extras_require={
"dev": [
"black",
"flake8>=3.8.4",
"isort>=5.0.0",
"mypy>=0.790",
"pre-commit>=2.9.3",
"pytest>=6.0.0",
"pytest-cov>=2.0.0",
"black>=22.1.0",
"flake8>=4.0.1",
"isort>=5.10.1",
"mypy>=0.931",
"pre-commit>=2.17.0",
"pytest>=6.2.1",
"pytest-cov>=2.10.1",
"sphinx",
"sphinx_rtd_theme",
"types-setuptools",
Expand Down

0 comments on commit 7adba8d

Please sign in to comment.