Skip to content

Commit 7da5919

Browse files
committed
2 parents ed56ff4 + 5598256 commit 7da5919

File tree

100 files changed

+1445
-1258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+1445
-1258
lines changed

docs/deprecated/distutils/apiref.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ directories.
10211021

10221022
Files in *src* that begin with :file:`.nfs` are skipped (more information on
10231023
these files is available in answer D2 of the `NFS FAQ page
1024-
<http://nfs.sourceforge.net/#section_d>`_).
1024+
<https://nfs.sourceforge.net/#section_d>`_).
10251025

10261026
.. versionchanged:: 3.3.1
10271027
NFS files are ignored.

docs/deprecated/distutils/examples.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,4 +335,4 @@ loads its values::
335335
.. % \section{Putting it all together}
336336
337337
338-
.. _docutils: http://docutils.sourceforge.net
338+
.. _docutils: https://docutils.sourceforge.io

docs/deprecated/distutils/setupscript.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ Notes:
644644

645645
'long string'
646646
Multiple lines of plain text in reStructuredText format (see
647-
http://docutils.sourceforge.net/).
647+
https://docutils.sourceforge.io/).
648648

649649
'list of strings'
650650
See below.

setuptools/_distutils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import sys
21
import importlib
2+
import sys
33

44
__version__, _, _ = sys.version.partition(' ')
55

setuptools/_distutils/_collections.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
from __future__ import annotations
2+
13
import collections
24
import functools
35
import itertools
46
import operator
7+
from collections.abc import Mapping
8+
from typing import Any
59

610

711
# from jaraco.collections 3.5.1
@@ -58,7 +62,7 @@ def __len__(self):
5862
return len(list(iter(self)))
5963

6064

61-
# from jaraco.collections 3.7
65+
# from jaraco.collections 5.0.1
6266
class RangeMap(dict):
6367
"""
6468
A dictionary-like object that uses the keys as bounds for a range.
@@ -70,7 +74,7 @@ class RangeMap(dict):
7074
One may supply keyword parameters to be passed to the sort function used
7175
to sort keys (i.e. key, reverse) as sort_params.
7276
73-
Let's create a map that maps 1-3 -> 'a', 4-6 -> 'b'
77+
Create a map that maps 1-3 -> 'a', 4-6 -> 'b'
7478
7579
>>> r = RangeMap({3: 'a', 6: 'b'}) # boy, that was easy
7680
>>> r[1], r[2], r[3], r[4], r[5], r[6]
@@ -82,7 +86,7 @@ class RangeMap(dict):
8286
>>> r[4.5]
8387
'b'
8488
85-
But you'll notice that the way rangemap is defined, it must be open-ended
89+
Notice that the way rangemap is defined, it must be open-ended
8690
on one side.
8791
8892
>>> r[0]
@@ -140,7 +144,12 @@ class RangeMap(dict):
140144
141145
"""
142146

143-
def __init__(self, source, sort_params={}, key_match_comparator=operator.le):
147+
def __init__(
148+
self,
149+
source,
150+
sort_params: Mapping[str, Any] = {},
151+
key_match_comparator=operator.le,
152+
):
144153
dict.__init__(self, source)
145154
self.sort_params = sort_params
146155
self.match = key_match_comparator

setuptools/_distutils/_itertools.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# from more_itertools 10.2
2+
def always_iterable(obj, base_type=(str, bytes)):
3+
"""If *obj* is iterable, return an iterator over its items::
4+
5+
>>> obj = (1, 2, 3)
6+
>>> list(always_iterable(obj))
7+
[1, 2, 3]
8+
9+
If *obj* is not iterable, return a one-item iterable containing *obj*::
10+
11+
>>> obj = 1
12+
>>> list(always_iterable(obj))
13+
[1]
14+
15+
If *obj* is ``None``, return an empty iterable:
16+
17+
>>> obj = None
18+
>>> list(always_iterable(None))
19+
[]
20+
21+
By default, binary and text strings are not considered iterable::
22+
23+
>>> obj = 'foo'
24+
>>> list(always_iterable(obj))
25+
['foo']
26+
27+
If *base_type* is set, objects for which ``isinstance(obj, base_type)``
28+
returns ``True`` won't be considered iterable.
29+
30+
>>> obj = {'a': 1}
31+
>>> list(always_iterable(obj)) # Iterate over the dict's keys
32+
['a']
33+
>>> list(always_iterable(obj, base_type=dict)) # Treat dicts as a unit
34+
[{'a': 1}]
35+
36+
Set *base_type* to ``None`` to avoid any special handling and treat objects
37+
Python considers iterable as iterable:
38+
39+
>>> obj = 'foo'
40+
>>> list(always_iterable(obj, base_type=None))
41+
['f', 'o', 'o']
42+
"""
43+
if obj is None:
44+
return iter(())
45+
46+
if (base_type is not None) and isinstance(obj, base_type):
47+
return iter((obj,))
48+
49+
try:
50+
return iter(obj)
51+
except TypeError:
52+
return iter((obj,))

setuptools/_distutils/_log.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
import logging
22

3-
43
log = logging.getLogger()

setuptools/_distutils/_macos_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import sys
21
import importlib
2+
import sys
33

44

55
def bypass_compiler_fixup(cmd, args):

setuptools/_distutils/_modified.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import functools
44
import os.path
55

6+
from ._functools import splat
67
from .errors import DistutilsFileError
78
from .py39compat import zip_strict
8-
from ._functools import splat
99

1010

1111
def _newer(source, target):

setuptools/_distutils/_msvccompiler.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,28 @@
1313
# ported to VS 2005 and VS 2008 by Christian Heimes
1414
# ported to VS 2015 by Steve Dower
1515

16+
import contextlib
1617
import os
1718
import subprocess
18-
import contextlib
19-
import warnings
2019
import unittest.mock as mock
20+
import warnings
2121

2222
with contextlib.suppress(ImportError):
2323
import winreg
2424

25+
from itertools import count
26+
27+
from ._log import log
28+
from .ccompiler import CCompiler, gen_lib_options
2529
from .errors import (
30+
CompileError,
2631
DistutilsExecError,
2732
DistutilsPlatformError,
28-
CompileError,
2933
LibError,
3034
LinkError,
3135
)
32-
from .ccompiler import CCompiler, gen_lib_options
33-
from ._log import log
3436
from .util import get_platform
3537

36-
from itertools import count
37-
3838

3939
def _find_vc2015():
4040
try:
@@ -253,7 +253,7 @@ def initialize(self, plat_name=None):
253253
vc_env = _get_vc_env(plat_spec)
254254
if not vc_env:
255255
raise DistutilsPlatformError(
256-
"Unable to find a compatible " "Visual Studio installation."
256+
"Unable to find a compatible Visual Studio installation."
257257
)
258258
self._configure(vc_env)
259259

0 commit comments

Comments
 (0)