Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit de48adc

Browse files
authored
Merge branch 'main' into gh-75367
2 parents ccb7fe7 + 0bb61dd commit de48adc

2 files changed

Lines changed: 17 additions & 18 deletions

File tree

Doc/library/logging.config.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ in :mod:`logging` itself) and defining handlers which are declared either in
111111
they or their ancestors are explicitly named
112112
in the logging configuration.
113113

114-
:param encoding: The encoding used to open file when *fname* is filename.
114+
:param encoding: The encoding used to open file when *fname* is filename.
115115

116116
.. versionchanged:: 3.4
117117
An instance of a subclass of :class:`~configparser.RawConfigParser` is

Tools/clinic/clinic.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@
2525
import sys
2626
import textwrap
2727
import traceback
28-
import types
2928

3029
from collections.abc import Callable
31-
from types import *
30+
from types import FunctionType, NoneType
3231
from typing import Any, NamedTuple
3332

3433
# TODO:
@@ -2669,15 +2668,15 @@ class CConverter(metaclass=CConverterAutoRegister):
26692668
# keep in sync with self_converter.__init__!
26702669
def __init__(self,
26712670
# Positional args:
2672-
name,
2673-
py_name,
2671+
name: str,
2672+
py_name: str,
26742673
function,
26752674
default=unspecified,
26762675
*, # Keyword only args:
2677-
c_default=None,
2678-
py_default=None,
2679-
annotation=unspecified,
2680-
unused=False,
2676+
c_default: str | None = None,
2677+
py_default: str | None = None,
2678+
annotation: str | Unspecified = unspecified,
2679+
unused: bool = False,
26812680
**kwargs
26822681
):
26832682
self.name = ensure_legal_c_identifier(name)
@@ -2713,10 +2712,10 @@ def __init__(self,
27132712
def converter_init(self):
27142713
pass
27152714

2716-
def is_optional(self):
2715+
def is_optional(self) -> bool:
27172716
return (self.default is not unspecified)
27182717

2719-
def _render_self(self, parameter, data):
2718+
def _render_self(self, parameter: str, data: CRenderData) -> None:
27202719
self.parameter = parameter
27212720
name = self.parser_name
27222721

@@ -2776,7 +2775,7 @@ def _render_non_self(self, parameter, data):
27762775
if cleanup:
27772776
data.cleanup.append('/* Cleanup for ' + name + ' */\n' + cleanup.rstrip() + "\n")
27782777

2779-
def render(self, parameter, data):
2778+
def render(self, parameter: str, data: CRenderData) -> None:
27802779
"""
27812780
parameter is a clinic.Parameter instance.
27822781
data is a CRenderData instance.
@@ -2852,31 +2851,31 @@ def declaration(self, *, in_parser=False):
28522851
declaration.append(';')
28532852
return "".join(declaration)
28542853

2855-
def initialize(self):
2854+
def initialize(self) -> str:
28562855
"""
28572856
The C statements required to set up this variable before parsing.
28582857
Returns a string containing this code indented at column 0.
28592858
If no initialization is necessary, returns an empty string.
28602859
"""
28612860
return ""
28622861

2863-
def modify(self):
2862+
def modify(self) -> str:
28642863
"""
28652864
The C statements required to modify this variable after parsing.
28662865
Returns a string containing this code indented at column 0.
28672866
If no modification is necessary, returns an empty string.
28682867
"""
28692868
return ""
28702869

2871-
def post_parsing(self):
2870+
def post_parsing(self) -> str:
28722871
"""
28732872
The C statements required to do some operations after the end of parsing but before cleaning up.
28742873
Return a string containing this code indented at column 0.
28752874
If no operation is necessary, return an empty string.
28762875
"""
28772876
return ""
28782877

2879-
def cleanup(self):
2878+
def cleanup(self) -> str:
28802879
"""
28812880
The C statements required to clean up after this variable.
28822881
Returns a string containing this code indented at column 0.
@@ -2929,7 +2928,7 @@ def parse_arg(self, argname, displayname):
29292928
""".format(argname=argname, paramname=self.parser_name, cast=cast)
29302929
return None
29312930

2932-
def set_template_dict(self, template_dict):
2931+
def set_template_dict(self, template_dict: dict[str, str]):
29332932
pass
29342933

29352934
@property
@@ -4037,7 +4036,7 @@ def eval_ast_expr(node, globals, *, filename='-'):
40374036

40384037
node = ast.Expression(node)
40394038
co = compile(node, filename, 'eval')
4040-
fn = types.FunctionType(co, globals)
4039+
fn = FunctionType(co, globals)
40414040
return fn()
40424041

40434042

0 commit comments

Comments
 (0)