Skip to content

Instantly share code, notes, and snippets.

View stephen-bunn's full-sized avatar
💭
Stuck in ideation

Stephen Bunn stephen-bunn

💭
Stuck in ideation
View GitHub Profile
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Ritashugisha
# GNUv3 License. <http://www.gnu.org/licenses/gpl-3.0.en.html>
"""
word_discovery
.. module:: word_discovery
:platform: Linux, MacOSX, Windows
@stephen-bunn
stephen-bunn / .editorconfig
Created April 24, 2019 16:46
Medium - Python Editorconfig Sample
# EditorConfig http://editorconfig.org
root = true
# global config
[*]
charset = utf-8
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
@stephen-bunn
stephen-bunn / isort.cfg
Created April 24, 2019 17:05
Medium - Black isort configuration
[isort]
atomic = true
not_skip = __init__.py
line_length = 88
indent = ' '
multi_line_output = 3
length_sort = 1
include_trailing_comma = true
@stephen-bunn
stephen-bunn / flake8.cfg
Last active April 24, 2019 17:07
Medium - Flake8 configuration
[flake8]
max-line-length = 88
ignore = D203,F401,E123,W503,E203
exclude =
.tox,
.git,
__pycache__,
docs/source/*,
build,
dist,
@stephen-bunn
stephen-bunn / test_ints_are_commutative.py
Created April 24, 2019 18:26
Medium - Hypothesis generation basic sample
from hypothesis import given
from hypothesis.strategies import integers
@given(integers(), integers())
def test_ints_are_commutative(x, y):
print(f"x = {x}, y = {y}")
assert x + y == y + x
@stephen-bunn
stephen-bunn / .pre-commit-config.yaml
Created April 24, 2019 19:07
Medium - Pre-commit sample configuration
repos:
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.0.0
hooks:
- id: flake8
@stephen-bunn
stephen-bunn / handle_dictionary.py
Last active April 25, 2019 13:32
Medium - Basic typing sample
from typing import Dict, List
def handle_dictionary(dictionary: Dict[str, List[int]]) -> int:
result = 0
for (key, value) in dictionary:
result += sum(value)
return result
@stephen-bunn
stephen-bunn / handle_dictionary.pyi
Created April 25, 2019 14:27
Medium - Handle dictionary stub sample
# Stubs for main (Python 3)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Dict, List
def handle_dictionary(dictionary: Dict[str, List[int]]) -> int: ...
@stephen-bunn
stephen-bunn / CHANGELOG.rst.jinja2
Created April 25, 2019 16:12
Medium - Towncrier CHANGELOG jinja2 template
{% for section in sections %}
{% set underline = "-" %}
{% if section %}
{{ section }}
{{ underline * section|length }}{% set underline = "~" %}
{% endif %}
{% if sections[section] %}
{% for category, value in definitions.items() if category in sections[section] and category != 'trivial' %}
@stephen-bunn
stephen-bunn / CHANGELOG.rst
Created April 25, 2019 16:33
Medium - Initial Towncrier changelog