Skip to content

Commit a4c5554

Browse files
committed
Format code using black
So we can automatically fix many formatting issues. https://black.readthedocs.io/ Drop pypy3 testing due to python/typed_ast#111
1 parent 02b10a3 commit a4c5554

File tree

19 files changed

+492
-440
lines changed

19 files changed

+492
-440
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
python-version: [3.6, 3.7, 3.8, pypy3]
16+
python-version: [3.6, 3.7, 3.8]
1717

1818
steps:
1919
- uses: actions/checkout@v2
@@ -26,8 +26,9 @@ jobs:
2626
- name: Lint
2727
if: matrix.python-version == '3.8'
2828
run: |
29-
pip install flake8
29+
pip install flake8 black
3030
flake8 git_stacktrace
31+
black --check .
3132
- name: Run Tests via Tox
3233
# Run tox using the version of Python in `PATH`
3334
run: tox -e py

doc/source/conf.py

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import git_stacktrace
2323

24-
sys.path.insert(0, os.path.abspath('.'))
24+
sys.path.insert(0, os.path.abspath("."))
2525

2626

2727
# -- General configuration ------------------------------------------------
@@ -33,27 +33,24 @@
3333
# Add any Sphinx extension module names here, as strings. They can be
3434
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3535
# ones.
36-
extensions = [
37-
'sphinx.ext.autodoc',
38-
'sphinx.ext.viewcode',
39-
'sphinx.ext.intersphinx']
36+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode", "sphinx.ext.intersphinx"]
4037

4138
# Add any paths that contain templates here, relative to this directory.
42-
templates_path = ['_templates']
39+
templates_path = ["_templates"]
4340

4441
# The suffix(es) of source filenames.
4542
# You can specify multiple suffix as a list of string:
4643
#
4744
# source_suffix = ['.rst', '.md']
48-
source_suffix = '.rst'
45+
source_suffix = ".rst"
4946

5047
# The master toctree document.
51-
master_doc = 'index'
48+
master_doc = "index"
5249

5350
# General information about the project.
54-
project = u'git-stacktrace'
55-
copyright = u'2017 Pinterest, Inc'
56-
author = u'Joe Gordon'
51+
project = u"git-stacktrace"
52+
copyright = u"2017 Pinterest, Inc"
53+
author = u"Joe Gordon"
5754

5855

5956
# The version info for the project you're documenting, acts as replacement for
@@ -78,7 +75,7 @@
7875
exclude_patterns = []
7976

8077
# The name of the Pygments (syntax highlighting) style to use.
81-
pygments_style = 'sphinx'
78+
pygments_style = "sphinx"
8279

8380
# If true, `todo` and `todoList` produce output, else they produce nothing.
8481
todo_include_todos = False
@@ -89,7 +86,7 @@
8986
# The theme to use for HTML and HTML Help pages. See the documentation for
9087
# a list of builtin themes.
9188
#
92-
html_theme = 'sphinx_rtd_theme'
89+
html_theme = "sphinx_rtd_theme"
9390

9491
# Theme options are theme-specific and customize the look and feel of a theme
9592
# further. For a list of options available for each theme, see the
@@ -100,28 +97,28 @@
10097
# Add any paths that contain custom static files (such as style sheets) here,
10198
# relative to this directory. They are copied after the builtin static files,
10299
# so a file named "default.css" will overwrite the builtin "default.css".
103-
html_static_path = ['_static']
100+
html_static_path = ["_static"]
104101

105102
# Custom sidebar templates, must be a dictionary that maps document names
106103
# to template names.
107104
#
108105
# This is required for the alabaster theme
109106
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
110107
html_sidebars = {
111-
'**': [
112-
'about.html',
113-
'navigation.html',
114-
'relations.html', # needs 'show_related': True theme option to display
115-
'searchbox.html',
116-
'donate.html',
108+
"**": [
109+
"about.html",
110+
"navigation.html",
111+
"relations.html", # needs 'show_related': True theme option to display
112+
"searchbox.html",
113+
"donate.html",
117114
]
118115
}
119116

120117

121118
# -- Options for HTMLHelp output ------------------------------------------
122119

123120
# Output file base name for HTML help builder.
124-
htmlhelp_basename = 'git-stacktracedoc'
121+
htmlhelp_basename = "git-stacktracedoc"
125122

126123

127124
# -- Options for LaTeX output ---------------------------------------------
@@ -130,15 +127,12 @@
130127
# The paper size ('letterpaper' or 'a4paper').
131128
#
132129
# 'papersize': 'letterpaper',
133-
134130
# The font size ('10pt', '11pt' or '12pt').
135131
#
136132
# 'pointsize': '10pt',
137-
138133
# Additional stuff for the LaTeX preamble.
139134
#
140135
# 'preamble': '',
141-
142136
# Latex figure (float) alignment
143137
#
144138
# 'figure_align': 'htbp',
@@ -148,19 +142,15 @@
148142
# (source start file, target name, title,
149143
# author, documentclass [howto, manual, or own class]).
150144
latex_documents = [
151-
(master_doc, 'git-stacktrace.tex', u'git-stacktrace Documentation',
152-
u'Joe Gordon', 'manual'),
145+
(master_doc, "git-stacktrace.tex", u"git-stacktrace Documentation", u"Joe Gordon", "manual"),
153146
]
154147

155148

156149
# -- Options for manual page output ---------------------------------------
157150

158151
# One entry per manual page. List of tuples
159152
# (source start file, name, description, authors, manual section).
160-
man_pages = [
161-
(master_doc, 'git-stacktrace', u'git-stacktrace Documentation',
162-
[author], 1)
163-
]
153+
man_pages = [(master_doc, "git-stacktrace", u"git-stacktrace Documentation", [author], 1)]
164154

165155

166156
# -- Options for Texinfo output -------------------------------------------
@@ -169,11 +159,17 @@
169159
# (source start file, target name, title, author,
170160
# dir menu entry, description, category)
171161
texinfo_documents = [
172-
(master_doc, 'git-stacktrace', u'git-stacktrace Documentation',
173-
author, 'git-stacktrace', 'One line description of project.',
174-
'Miscellaneous'),
162+
(
163+
master_doc,
164+
"git-stacktrace",
165+
u"git-stacktrace Documentation",
166+
author,
167+
"git-stacktrace",
168+
"One line description of project.",
169+
"Miscellaneous",
170+
),
175171
]
176172

177173

178174
# Example configuration for intersphinx: refer to the Python standard library.
179-
intersphinx_mapping = {'https://docs.python.org/': None}
175+
intersphinx_mapping = {"https://docs.python.org/": None}

git_stacktrace/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import pkg_resources
22

3-
__version__ = pkg_resources.get_provider(pkg_resources.Requirement.parse('git-stacktrace')).version
3+
__version__ = pkg_resources.get_provider(pkg_resources.Requirement.parse("git-stacktrace")).version

git_stacktrace/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
def _longest_filename(matches):
3131
"""find longest match by number of '/'."""
32-
return max(matches, key=lambda filename: len(filename.split('/')))
32+
return max(matches, key=lambda filename: len(filename.split("/")))
3333

3434

3535
def _lookup_files(commit_files, git_files, traceback, results):

git_stacktrace/cmd.py

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,42 @@ def main():
1717
description = "Lookup commits related to a given stacktrace."
1818
parser = argparse.ArgumentParser(usage=usage, description=description)
1919
range_group = parser.add_mutually_exclusive_group()
20-
range_group.add_argument('--since', metavar="<date1>", help='show commits '
21-
'more recent than a specific date (from git-log)')
22-
range_group.add_argument('range', nargs='?', help='git commit range to use')
23-
range_group.add_argument('--server', action="store_true", help='start a '
24-
'webserver to visually interact with git-stacktrace')
25-
parser.add_argument('--port', default=os.environ.get('GIT_STACKTRACE_PORT', 8080),
26-
type=int, help='Server port')
27-
parser.add_argument('-f', '--fast', action="store_true", help='Speed things up by not running '
28-
'pickaxe if the file for a line of code cannot be found')
29-
parser.add_argument('-b', '--branch', nargs='?', help='Git branch. If using --since, use this to '
30-
'specify which branch to run since on. Runs on current branch by default')
31-
parser.add_argument('--version', action="version",
32-
version='%s version %s' % (os.path.split(sys.argv[0])[-1], git_stacktrace.__version__))
33-
parser.add_argument('-d', '--debug', action='store_true', help='Enable debug logging')
20+
range_group.add_argument(
21+
"--since", metavar="<date1>", help="show commits " "more recent than a specific date (from git-log)"
22+
)
23+
range_group.add_argument("range", nargs="?", help="git commit range to use")
24+
range_group.add_argument(
25+
"--server", action="store_true", help="start a " "webserver to visually interact with git-stacktrace"
26+
)
27+
parser.add_argument("--port", default=os.environ.get("GIT_STACKTRACE_PORT", 8080), type=int, help="Server port")
28+
parser.add_argument(
29+
"-f",
30+
"--fast",
31+
action="store_true",
32+
help="Speed things up by not running " "pickaxe if the file for a line of code cannot be found",
33+
)
34+
parser.add_argument(
35+
"-b",
36+
"--branch",
37+
nargs="?",
38+
help="Git branch. If using --since, use this to "
39+
"specify which branch to run since on. Runs on current branch by default",
40+
)
41+
parser.add_argument(
42+
"--version",
43+
action="version",
44+
version="%s version %s" % (os.path.split(sys.argv[0])[-1], git_stacktrace.__version__),
45+
)
46+
parser.add_argument("-d", "--debug", action="store_true", help="Enable debug logging")
3447
args = parser.parse_args()
3548

36-
logging.basicConfig(format='%(name)s:%(funcName)s:%(lineno)s: %(message)s')
49+
logging.basicConfig(format="%(name)s:%(funcName)s:%(lineno)s: %(message)s")
3750
if args.debug:
3851
logging.getLogger().setLevel(logging.DEBUG)
3952

4053
if args.server:
4154
print("Starting httpd on port %s..." % args.port)
42-
httpd = make_server('', args.port, server.application)
55+
httpd = make_server("", args.port, server.application)
4356
try:
4457
httpd.serve_forever()
4558
except KeyboardInterrupt:

0 commit comments

Comments
 (0)