Skip to content

Commit 5feb363

Browse files
authored
Create autoblack.yml (#5)
* Create autoblack.yml * autoblack fix * Create pyproject.toml * autoblack fix * Update setup.cfg Co-authored-by: AutoBlack <>
1 parent 2953d94 commit 5feb363

File tree

10 files changed

+206
-139
lines changed

10 files changed

+206
-139
lines changed

.github/workflows/autoblack.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Format python code
2+
on: push
3+
jobs:
4+
autoblack:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@master
8+
- name: autoblack
9+
uses: lgeiger/black-action@v1.0.1
10+
with:
11+
args: "."
12+
- name: Commit and push changes
13+
uses: stefanzweifel/git-auto-commit-action@v2.0.0
14+
with:
15+
commit_author_email: ''
16+
commit_author_name: AutoBlack
17+
commit_message: autoblack fix
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docs/source/conf.py

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919

2020
# -- Project information -----------------------------------------------------
2121

22-
project = 'ImageTilingUtils'
23-
copyright = '2019, vfdev-5'
24-
author = 'vfdev-5'
22+
project = "ImageTilingUtils"
23+
copyright = "2019, vfdev-5"
24+
author = "vfdev-5"
2525

2626
# The short X.Y version
2727
version = tiling.__version__
@@ -39,26 +39,26 @@
3939
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4040
# ones.
4141
extensions = [
42-
'sphinx.ext.autodoc',
43-
'sphinx.ext.autosummary',
44-
'sphinx.ext.coverage',
45-
'sphinx.ext.mathjax',
46-
'sphinx.ext.napoleon',
47-
'sphinx.ext.viewcode',
42+
"sphinx.ext.autodoc",
43+
"sphinx.ext.autosummary",
44+
"sphinx.ext.coverage",
45+
"sphinx.ext.mathjax",
46+
"sphinx.ext.napoleon",
47+
"sphinx.ext.viewcode",
4848
]
4949

5050
# Add any paths that contain templates here, relative to this directory.
51-
templates_path = ['_templates']
51+
templates_path = ["_templates"]
5252

5353
# The suffix(es) of source filenames.
5454
# You can specify multiple suffix as a list of string:
5555
source_parsers = {
56-
'.md': CommonMarkParser,
56+
".md": CommonMarkParser,
5757
}
58-
source_suffix = ['.rst', '.md']
58+
source_suffix = [".rst", ".md"]
5959

6060
# The master toctree document.
61-
master_doc = 'index'
61+
master_doc = "index"
6262

6363
# The language for content autogenerated by Sphinx. Refer to documentation
6464
# for a list of supported languages.
@@ -73,23 +73,23 @@
7373
exclude_patterns = []
7474

7575
# The name of the Pygments (syntax highlighting) style to use.
76-
pygments_style = 'sphinx'
76+
pygments_style = "sphinx"
7777

7878

7979
# -- Options for HTML output -------------------------------------------------
8080

8181
# The theme to use for HTML and HTML Help pages. See the documentation for
8282
# a list of builtin themes.
8383
#
84-
html_theme = 'sphinx_rtd_theme'
84+
html_theme = "sphinx_rtd_theme"
8585
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
8686

8787
# Theme options are theme-specific and customize the look and feel of a theme
8888
# further. For a list of options available for each theme, see the
8989
# documentation.
9090
#
9191
html_theme_options = {
92-
'collapse_navigation': False,
92+
"collapse_navigation": False,
9393
}
9494

9595
# Add any paths that contain custom static files (such as style sheets) here,
@@ -111,7 +111,7 @@
111111
# -- Options for HTMLHelp output ---------------------------------------------
112112

113113
# Output file base name for HTML help builder.
114-
htmlhelp_basename = 'ImageTilingUtilsdoc'
114+
htmlhelp_basename = "ImageTilingUtilsdoc"
115115

116116

117117
# -- Options for LaTeX output ------------------------------------------------
@@ -120,15 +120,12 @@
120120
# The paper size ('letterpaper' or 'a4paper').
121121
#
122122
# 'papersize': 'letterpaper',
123-
124123
# The font size ('10pt', '11pt' or '12pt').
125124
#
126125
# 'pointsize': '10pt',
127-
128126
# Additional stuff for the LaTeX preamble.
129127
#
130128
# 'preamble': '',
131-
132129
# Latex figure (float) alignment
133130
#
134131
# 'figure_align': 'htbp',
@@ -138,19 +135,15 @@
138135
# (source start file, target name, title,
139136
# author, documentclass [howto, manual, or own class]).
140137
latex_documents = [
141-
(master_doc, 'ImageTilingUtils.tex', 'ImageTilingUtils Documentation',
142-
'vfdev-5', 'manual'),
138+
(master_doc, "ImageTilingUtils.tex", "ImageTilingUtils Documentation", "vfdev-5", "manual",),
143139
]
144140

145141

146142
# -- Options for manual page output ------------------------------------------
147143

148144
# One entry per manual page. List of tuples
149145
# (source start file, name, description, authors, manual section).
150-
man_pages = [
151-
(master_doc, 'imagetilingutils', 'ImageTilingUtils Documentation',
152-
[author], 1)
153-
]
146+
man_pages = [(master_doc, "imagetilingutils", "ImageTilingUtils Documentation", [author], 1)]
154147

155148

156149
# -- Options for Texinfo output ----------------------------------------------
@@ -159,9 +152,15 @@
159152
# (source start file, target name, title, author,
160153
# dir menu entry, description, category)
161154
texinfo_documents = [
162-
(master_doc, 'ImageTilingUtils', 'ImageTilingUtils Documentation',
163-
author, 'ImageTilingUtils', 'One line description of project.',
164-
'Miscellaneous'),
155+
(
156+
master_doc,
157+
"ImageTilingUtils",
158+
"ImageTilingUtils Documentation",
159+
author,
160+
"ImageTilingUtils",
161+
"One line description of project.",
162+
"Miscellaneous",
163+
),
165164
]
166165

167166
# -- Extension configuration -------------------------------------------------

pyproject.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[tool.black]
2+
line-length = 120
3+
target-version = ['py35', 'py36', 'py37', 'py38']
4+
include = '\.pyi?$'
5+
exclude = '''
6+
(
7+
/(
8+
\.eggs # exclude a few common directories in the
9+
| \.git # root of the project
10+
| \.hg
11+
| \.mypy_cache
12+
| \.tox
13+
| \.venv
14+
| _build
15+
| buck-out
16+
| build
17+
| dist
18+
)/
19+
| foo.py # also separately exclude a file named foo.py in
20+
# the root of the project
21+
)
22+
'''

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ max-line-length = 120
33

44
[flake8]
55
max-line-length = 120
6-
ignore = F401,E402,F403
6+
ignore = F401,E402,F403,E231
77
exclude = venv
88

99
[bdist_wheel]

setup.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66

77
def read(*names):
8-
with codecs_open(os.path.join(os.path.dirname(__file__), *names),
9-
encoding="utf-8") as fp:
8+
with codecs_open(os.path.join(os.path.dirname(__file__), *names), encoding="utf-8") as fp:
109
return fp.read()
1110

1211

@@ -19,28 +18,21 @@ def find_version(*file_paths):
1918

2019

2120
long_description = read("README.md")
22-
version = find_version('tiling', '__init__.py')
21+
version = find_version("tiling", "__init__.py")
2322

2423

2524
setup(
2625
name="tiling",
2726
version=version,
28-
description=u"Minimalistic set of image reader agnostic tools to easily iterate over large images",
27+
description="Minimalistic set of image reader agnostic tools to easily iterate over large images",
2928
long_description=long_description,
3029
long_description_content_type="text/markdown",
3130
author="vfdev-5",
3231
author_email="vfdev.5@gmail.com",
3332
url="https://github.com/vfdev-5/ImageTilingUtils",
34-
packages=find_packages(exclude=['tests', 'examples']),
35-
install_requires=[
36-
'six',
37-
],
38-
license='MIT',
33+
packages=find_packages(exclude=["tests", "examples"]),
34+
install_requires=["six",],
35+
license="MIT",
3936
test_suite="tests",
40-
extras_require={
41-
'tests': [
42-
'pytest',
43-
'pytest-cov'
44-
]
45-
}
37+
extras_require={"tests": ["pytest", "pytest-cov"]},
4638
)

tests/test_const_size.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
21
import unittest
32

43
from tiling import ConstSizeTiles
54

65

76
class TestConstSizeTiles(unittest.TestCase):
8-
97
def test_wrong_args(self):
108

11-
assertRaisesRegex = self.assertRaisesRegex if hasattr(self, 'assertRaisesRegex') else self.assertRaisesRegexp
9+
assertRaisesRegex = self.assertRaisesRegex if hasattr(self, "assertRaisesRegex") else self.assertRaisesRegexp
1210

13-
with assertRaisesRegex(ValueError, "Argument min_overlapping should be between 0 and min tile_extent"):
11+
with assertRaisesRegex(
12+
ValueError, "Argument min_overlapping should be between 0 and min tile_extent",
13+
):
1414
ConstSizeTiles((500, 500), (256, 256), min_overlapping=-1)
1515

16-
with assertRaisesRegex(ValueError, "Argument min_overlapping should be between 0 and min tile_extent"):
16+
with assertRaisesRegex(
17+
ValueError, "Argument min_overlapping should be between 0 and min tile_extent",
18+
):
1719
ConstSizeTiles((500, 500), (256, 256), min_overlapping=300)
1820

19-
with assertRaisesRegex(ValueError, "Argument min_overlapping should be between 0 and min tile_extent"):
21+
with assertRaisesRegex(
22+
ValueError, "Argument min_overlapping should be between 0 and min tile_extent",
23+
):
2024
ConstSizeTiles((500, 500), (256, 256), min_overlapping=256)
2125

2226
def test_wrong_index(self):
@@ -54,15 +58,11 @@ def test_as_iterator(self):
5458
self.assertEqual(extent1, extent2)
5559

5660
def test_all(self):
57-
5861
def _test(im_size, ts, scale, min_overlapping):
5962

60-
debug_msg = "im_size={} ts={} scale={} min_overlapping={}\n" \
61-
.format(im_size, ts, scale, min_overlapping)
63+
debug_msg = "im_size={} ts={} scale={} min_overlapping={}\n".format(im_size, ts, scale, min_overlapping)
6264

63-
tiles = ConstSizeTiles((im_size, im_size), ts,
64-
min_overlapping=min_overlapping,
65-
scale=scale)
65+
tiles = ConstSizeTiles((im_size, im_size), ts, min_overlapping=min_overlapping, scale=scale)
6666

6767
debug_msg += "n={}\n".format(len(tiles))
6868
self.assertGreater(len(tiles), 0, debug_msg)
@@ -78,15 +78,15 @@ def _test(im_size, ts, scale, min_overlapping):
7878
for i in range(1, len(tiles)):
7979
extent, _ = tiles[i]
8080
prev_extent, _ = tiles[i - 1]
81-
var_debug_msg = "i={} extent={}\n" \
82-
.format(i, extent)
83-
var_debug_msg += "prev_extent={}\n" \
84-
.format(prev_extent)
81+
var_debug_msg = "i={} extent={}\n".format(i, extent)
82+
var_debug_msg += "prev_extent={}\n".format(prev_extent)
8583

8684
for j in [0, 1]:
87-
self.assertGreaterEqual(tiles.tile_size[j] / tiles.scale - tiles.min_overlapping,
88-
extent[j] - prev_extent[j],
89-
debug_msg + var_debug_msg)
85+
self.assertGreaterEqual(
86+
tiles.tile_size[j] / tiles.scale - tiles.min_overlapping,
87+
extent[j] - prev_extent[j],
88+
debug_msg + var_debug_msg,
89+
)
9090

9191
# Check the last tile ends at the boundary
9292
extent, _ = tiles[-1]

0 commit comments

Comments
 (0)