-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix-cygwin-ci
- Loading branch information
Showing
40 changed files
with
717 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[run] | ||
omit = | ||
# leading `*/` for pytest-dev/pytest-cov#456 | ||
*/.tox/* | ||
disable_warnings = | ||
couldnt-parse | ||
|
||
[report] | ||
show_missing = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = tab | ||
indent_size = 4 | ||
insert_final_newline = true | ||
end_of_line = lf | ||
|
||
[*.py] | ||
indent_style = space | ||
max_line_length = 88 | ||
|
||
[*.{yml,yaml}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.rst] | ||
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
allow: | ||
- dependency-type: "all" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.1.8 | ||
hooks: | ||
- id: ruff | ||
- id: ruff-format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: 2 | ||
python: | ||
install: | ||
- path: . | ||
extra_requirements: | ||
- docs | ||
|
||
# required boilerplate readthedocs/readthedocs.org#10401 | ||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to | ||
deal in the Software without restriction, including without limitation the | ||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
sell copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
"""Timestamp comparison of files and groups of files.""" | ||
|
||
import functools | ||
import os.path | ||
|
||
from .errors import DistutilsFileError | ||
from .py39compat import zip_strict | ||
from ._functools import splat | ||
|
||
|
||
def _newer(source, target): | ||
return not os.path.exists(target) or ( | ||
os.path.getmtime(source) > os.path.getmtime(target) | ||
) | ||
|
||
|
||
def newer(source, target): | ||
""" | ||
Is source modified more recently than target. | ||
Returns True if 'source' is modified more recently than | ||
'target' or if 'target' does not exist. | ||
Raises DistutilsFileError if 'source' does not exist. | ||
""" | ||
if not os.path.exists(source): | ||
raise DistutilsFileError("file '%s' does not exist" % os.path.abspath(source)) | ||
|
||
return _newer(source, target) | ||
|
||
|
||
def newer_pairwise(sources, targets, newer=newer): | ||
""" | ||
Filter filenames where sources are newer than targets. | ||
Walk two filename iterables in parallel, testing if each source is newer | ||
than its corresponding target. Returns a pair of lists (sources, | ||
targets) where source is newer than target, according to the semantics | ||
of 'newer()'. | ||
""" | ||
newer_pairs = filter(splat(newer), zip_strict(sources, targets)) | ||
return tuple(map(list, zip(*newer_pairs))) or ([], []) | ||
|
||
|
||
def newer_group(sources, target, missing='error'): | ||
""" | ||
Is target out-of-date with respect to any file in sources. | ||
Return True if 'target' is out-of-date with respect to any file | ||
listed in 'sources'. In other words, if 'target' exists and is newer | ||
than every file in 'sources', return False; otherwise return True. | ||
``missing`` controls how to handle a missing source file: | ||
- error (default): allow the ``stat()`` call to fail. | ||
- ignore: silently disregard any missing source files. | ||
- newer: treat missing source files as "target out of date". This | ||
mode is handy in "dry-run" mode: it will pretend to carry out | ||
commands that wouldn't work because inputs are missing, but | ||
that doesn't matter because dry-run won't run the commands. | ||
""" | ||
|
||
def missing_as_newer(source): | ||
return missing == 'newer' and not os.path.exists(source) | ||
|
||
ignored = os.path.exists if missing == 'ignore' else None | ||
return any( | ||
missing_as_newer(source) or _newer(source, target) | ||
for source in filter(ignored, sources) | ||
) | ||
|
||
|
||
newer_pairwise_group = functools.partial(newer_pairwise, newer=newer_group) |
Oops, something went wrong.