-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sourcery refactored main branch #1
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,7 +193,7 @@ | |
html_title = "pytest documentation" | ||
|
||
# A shorter title for the navigation bar. Default is the same as html_title. | ||
html_short_title = "pytest-%s" % release | ||
html_short_title = f"pytest-{release}" | ||
|
||
# The name of an image file (relative to this directory) to place at the top | ||
# of the sidebar. | ||
|
@@ -402,17 +402,20 @@ def configure_logging(app: "sphinx.application.Sphinx") -> None: | |
import sphinx.util.logging | ||
import logging | ||
|
||
|
||
|
||
class WarnLogFilter(logging.Filter): | ||
def filter(self, record: logging.LogRecord) -> bool: | ||
"""Ignore warnings about missing include with "only" directive. | ||
|
||
Ref: https://github.com/sphinx-doc/sphinx/issues/2150.""" | ||
if ( | ||
record.msg.startswith('Problems with "include" directive path:') | ||
and "_changelog_towncrier_draft.rst" in record.msg | ||
): | ||
return False | ||
return True | ||
return ( | ||
not record.msg.startswith( | ||
'Problems with "include" directive path:' | ||
) | ||
or "_changelog_towncrier_draft.rst" not in record.msg | ||
) | ||
|
||
Comment on lines
404
to
+418
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
logger = logging.getLogger(sphinx.util.logging.NAMESPACE) | ||
warn_handler = [x for x in logger.handlers if x.level == logging.WARNING] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,7 @@ def test_eq_longer_list(self): | |
assert [1, 2] == [1, 2, 3] | ||
|
||
def test_in_list(self): | ||
assert 1 in [0, 2, 3, 4, 5] | ||
assert 1 in {0, 2, 3, 4, 5} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
def test_not_in_text_multiline(self): | ||
text = "some multiline\ntext\nwhich\nincludes foo\nand a\ntail" | ||
|
@@ -180,8 +180,7 @@ def test_reinterpret_fails_with_print_for_the_fun_of_it(self): | |
a, b = items.pop() | ||
|
||
def test_some_error(self): | ||
if namenotexi: # NOQA | ||
pass | ||
pass | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
This removes the following comments ( why? ):
|
||
|
||
def func1(self): | ||
assert 41 == 42 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,11 @@ def setup_module(module): | |
|
||
|
||
class TestStateFullThing: | ||
def setup_class(cls): | ||
cls.classcount += 1 | ||
def setup_class(self): | ||
self.classcount += 1 | ||
Comment on lines
-6
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
def teardown_class(cls): | ||
cls.classcount -= 1 | ||
def teardown_class(self): | ||
self.classcount -= 1 | ||
Comment on lines
-9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
def setup_method(self, method): | ||
self.id = eval(method.__name__[5:]) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,10 +46,10 @@ def main(args): | |
|
||
def _get_kind(issue): | ||
labels = [label["name"] for label in issue["labels"]] | ||
for key in ("bug", "enhancement", "proposal"): | ||
if key in labels: | ||
return key | ||
return "issue" | ||
return next( | ||
(key for key in ("bug", "enhancement", "proposal") if key in labels), | ||
"issue", | ||
) | ||
Comment on lines
-49
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
|
||
def report(issues): | ||
|
@@ -59,15 +59,15 @@ def report(issues): | |
kind = _get_kind(issue) | ||
status = issue["state"] | ||
number = issue["number"] | ||
link = "https://github.com/pytest-dev/pytest/issues/%s/" % number | ||
link = f"https://github.com/pytest-dev/pytest/issues/{number}/" | ||
print("----") | ||
print(status, kind, link) | ||
print(title) | ||
# print() | ||
# lines = body.split("\n") | ||
# print("\n".join(lines[:3])) | ||
# if len(lines) > 3 or len(body) > 240: | ||
# print("...") | ||
# print() | ||
# lines = body.split("\n") | ||
# print("\n".join(lines[:3])) | ||
# if len(lines) > 3 or len(body) > 240: | ||
# print("...") | ||
Comment on lines
-62
to
+70
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
print("\n\nFound %s open issues" % len(issues)) | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,8 +139,7 @@ def find_next_version( | |
output = check_output(["git", "tag"], encoding="UTF-8") | ||
valid_versions = [] | ||
for v in output.splitlines(): | ||
m = re.match(r"\d.\d.\d+$", v.strip()) | ||
if m: | ||
if m := re.match(r"\d.\d.\d+$", v.strip()): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
valid_versions.append(tuple(int(x) for x in v.split("."))) | ||
|
||
valid_versions.sort() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,12 +43,10 @@ def parse_changelog(tag_name): | |
consuming_version = False | ||
version_lines = [] | ||
for line in changelog_lines: | ||
m = title_regex.match(line) | ||
if m: | ||
if m := title_regex.match(line): | ||
# found the version we want: start to consume lines until we find the next version title | ||
if m.group(1) == tag_name: | ||
if m[1] == tag_name: | ||
consuming_version = True | ||
# found a new version title while parsing the version we want: break out | ||
Comment on lines
-46
to
-51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
This removes the following comments ( why? ):
|
||
elif consuming_version: | ||
break | ||
if consuming_version: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,11 +52,12 @@ def iter_plugins(): | |
regex = r">([\d\w-]*)</a>" | ||
response = requests.get("https://pypi.org/simple") | ||
|
||
matches = list( | ||
matches = [ | ||
match | ||
for match in re.finditer(regex, response.text) | ||
if match.groups()[0].startswith("pytest-") | ||
) | ||
] | ||
|
||
Comment on lines
-55
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
for match in tqdm(matches, smoothing=0): | ||
name = match.groups()[0] | ||
|
@@ -69,12 +70,15 @@ def iter_plugins(): | |
info = response.json()["info"] | ||
if "Development Status :: 7 - Inactive" in info["classifiers"]: | ||
continue | ||
for classifier in DEVELOPMENT_STATUS_CLASSIFIERS: | ||
if classifier in info["classifiers"]: | ||
status = classifier[22:] | ||
break | ||
else: | ||
status = "N/A" | ||
status = next( | ||
( | ||
classifier[22:] | ||
for classifier in DEVELOPMENT_STATUS_CLASSIFIERS | ||
if classifier in info["classifiers"] | ||
), | ||
"N/A", | ||
) | ||
|
||
requires = "N/A" | ||
if info["requires_dist"]: | ||
for requirement in info["requires_dist"]: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,7 +87,7 @@ def __call__(self, prefix: str, **kwargs: Any) -> List[str]: | |
if "*" not in prefix and "?" not in prefix: | ||
# We are on unix, otherwise no bash. | ||
if not prefix or prefix[-1] == os.path.sep: | ||
globbed.extend(glob(prefix + ".*")) | ||
globbed.extend(glob(f"{prefix}.*")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
prefix += "*" | ||
globbed.extend(glob(prefix)) | ||
for x in sorted(globbed): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines
196-196
refactored with the following changes:replace-interpolation-with-fstring
)